I need help in setting nginx proxy to a websocket server.
Connect: var socket = new WebSocket("ws://site.com:9078");
In this case everything works good.
Making proxy, nginx.conf:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream ws1 {
server site.com:9078;
}
server {
location /ws1/ {
proxy_pass http://ws1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Connect: var socket = new WebSocket("ws://site.com/ws1/");
ERROR: Firefox can not setup connection ws://cthutq2012.ru/ws1/
Whats wrong and what need to be fixed?
Connect: var socket = new WebSocket("ws://site.com:9078");
In this case everything works good.
Making proxy, nginx.conf:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream ws1 {
server site.com:9078;
}
server {
location /ws1/ {
proxy_pass http://ws1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Connect: var socket = new WebSocket("ws://site.com/ws1/");
ERROR: Firefox can not setup connection ws://cthutq2012.ru/ws1/
Whats wrong and what need to be fixed?