I've created a websocket using tornado which is being consumed by angular js code.
Now I'm setting up a proxy in between using NGINX. With this my websocket stops working. Actually it is searching for a websocket in proxy server. This indicates that the redirection through proxy_pass is not working.
Here is the sample of my Nginx proxy configuration.
http
{
......
.....
#Few lines omitted here.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
map $cookie_cookiename $redirectpath {
default list";
"1" "list1";
"2" "list2";
}
server {
listen 80;
root /var/www/myapplication/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
location / {
rewrite ^/(.+) /$redirectpath/$1 last;
}
location /list/ {
}
location /1/ {
}
location /2/ {
}
}
Thanks in advance.