Answer the question
In order to leave comments, you need to log in
WebSocket Nginx HTTP/1.1 426 Upgrade Required?
Greetings!
The problem that burned the whole brain, the essence of which is that
On the VPS, openvpn was raised on the network of which resources were collected and brought to the outside world through Nginx reverse proxy and everything seemed to work with a bang until it was necessary to install KANBAN + GITLAB ( kanban.leanlabs. io/), which in turn uses WebSocket.
Having read in the documentation kanban.leanlabs.io/docs/configuration/webserver/nginx how to configure nginx to work, I did this, but received a dul in response.
An inquisitive brain led me to the idea of raising the simplest chat on NODE.js + WebSocket, which was googled ( https://learn.javascript.ru/websockets) and done.
Everything works on the local machine, with a direct connection through a virtual network it also works. Through Nginx
nginx/1.12 no
header from browser
map $http_upgrade $connection_upgrade {
default upgrade;
"" close;
}
#upstream websockets{
# server 10.8.0.115:9081;
#}
server {
listen 80;
server_name wiki.mirten.com;
access_log /var/log/nginx/acc_chat2.log;
error_log /var/log/nginx/err_chat2.log;
client_max_body_size 200G; # максимальный файл для загрузки
location /ws {
proxy_pass http://10.8.0.115:9081/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_read_timeout 86400;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_buffering off;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question