Today, I met a big pit when releasing the project. I will record it here. If someone encounters it in the future, they can refer to it to solve it, so as to avoid detour and delay time
Use nginx (version 1.12.2) to forward HTTPS packets to nginx on another server.
After the React project was successfully deployed, the problem was that most people accessing HTTPS showed a blank page, but my Chrome browser was consistently accessible, while everyone else’s browser was intermittently accessible. At first, I suspected the cache problem of reverse proxy Nginx, so I tried to modify the configuration file of forwarding Nginx, add the configuration that does not cache in the configuration file, and then use the browser to access, but still failed several times. After several failed attempts, the developer tool of Chrome was used to check the error and the network request. The Chrome console reported an error that the main. Xxx. js in the react project could not be read. At this time, the problem was locked, maybe there was something wrong with the JS file, so I asked my colleague to redeploy it again, but it was still not solved. At this time, I considered to find the problem from the network request, switched to the Network option of Chrome, and found that the js file request failed after reading more than 400 ms. The react-deployed Nginx takes about 4 seconds to read this js file, so it is possible that the reverse proxy nginx needs to set the timeout period. By default, the nginx proxy reads the js file in 60 seconds. Nginx has set a limit on the size of the file, so it can be used as a proxy for nginx to set a limit on the size of the file. Nginx has a proxy_buffers configuration item that specifies the size of the proxy buffer. The total size is numberSize. Nginx, which is 64kb), starts the configuration, restarts the agent nginx, and finds that it works. In summary, in fact, the reason why there is this problem is because the page size is not optimized, or to optimize the page size