Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

nginx proxy websocket

$
0
0
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?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>