When nginx is not configured to support webocket, but the domain name has been configured, such as: ws://gofly.sopans.com/ws_visitor
Direct js connection will return a 400 error
You need to add these three headers under the nginx location block to upgrade the http connection to a websocket connection
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
For example, I open source customer gofly in
server{ listen 80 ; server_name gofly.sopans.com; access_log /var/log/nginx/ gofly.sopans.com.access.log main; client_max_body_size 10M; location /static { root /var/www/html/go- fly; } location / { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1 ; proxy_set_header X-Real- IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade" ; } }
Read More:
- [Solved] jumpserver nginx Error: Connect websocket server error
- How to Solve Nginx 413 Error (request entity too large)
- [Solved] Websocket Error: WebSocket is already in CLOSING or CLOSED state
- Nginx: How to Use Error_Page
- Nginx Container Error: nginx: [emerg] mkdir() “/var/cache/nginx/client_temp“ failed (13: Permission denied)
- [Solved] Playbook Start Nginx Error: Unable to start service nginx: Job for nginx.service fd with error code
- How to Solve Error inflating class android.support.design.widget.FloatingActionButton
- How to Solve Nginx cross compilation Error
- Gitlab nginx wont start to work. [down: nginx: 1s, normally up, want up; run: log: (pid 20128)xxx]
- Stream to MemoryStream to solve Stream.Length error report This stream does not support search operations
- [GO]Solve request origin not allowed by Upgrader.CheckOrigin websocket cross-domain
- Websocket: How to Fix Error Read Econnreset
- [Solved] Windows Nginx Startup Error: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket
- [Solved] Docker Start nginx error: driver failed programming external connectivity on endpoint nginx
- How to Configure OpenFPGA Environment (Probable Errors & Their Solutions)
- Solution: configuration of multiple front ends separated from front end and back end of nginx
- [Solved] Doris StreamLoad Error: load by MERGE or DELETE need to upgrade table to support batch delete
- Cmake Setting Support C++11 This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options
- Implement base64_decode in GO language to solve the problem of illegal characters
- Filezilla Error: You appear to be behind a NAT router. Please configure the passive mode settings and …