After websocket is introduced into the project, it will work normally locally and report 400 as soon as it is installed in the production environment
reason: when nginx is configured in the production environment, the nginx agent fails to pass, and the relevant information needs to be configured in the configuration file nginx.conf
Solution:
Add in the location of nginx file
proxy_ http_ version 1.1;
proxy_ set_ header Upgrade $http_ upgrade;
proxy_ set_ header Connection “upgrade”;
The first line tells nginx to use HTTP/1.1 when communicating with the node backend, which is required by WebSockets. The next two lines tell nginx to respond to the upgrade request, which is initiated by HTTP when the browser wants to use websocket. All three lines must be added
Similar Posts:
- Solve the 400 error of nginx forwarding websocket
- Error during WebSocket handshake 403 [How to Solve]
- Fix Nginx 502 Error:upstream sent too big header while reading response header from upstream
- hessian http response code:411 [How to Solve]
- [Solved] Nginx proxy Timeout: upstream timed out (110: Connection timed out)
- Solving the problem of nginx reverse proxy web service soap:address location problem
- [Solved] Nginx reverse proxy 502 permission denied
- Client IP address forgery, CDN, reverse proxy, access to those things
- Nginx normal user startup configuration error: && springboot-swagger & Unable to infer base url
- Nginx Timeout Error: upstream timed out (110: Connection timed out) while reading response header from ups…