connect socket.io android client through a reverse proxy server to socket server connect socket.io android client through a reverse proxy server to socket server nginx nginx

connect socket.io android client through a reverse proxy server to socket server


The url you're using is the issue, since you might need to pass it to proxy anyways for your routing purposes please try the following in your nginx conf. Hope this helps.

location ~ /app/v2/(?<section>.*) {        proxy_cache apicache;        proxy_cache_revalidate on;        proxy_cache_min_uses 2;        proxy_cache_use_stale error timeout updating http_500 http_502                      http_503 http_504;        proxy_cache_lock on;        proxy_cache_bypass $http_cache_control;        add_header X-Proxy-Cache $upstream_cache_status;        proxy_cache_methods GET;        proxy_cache_valid 200 302 2s;        proxy_cache_valid 404 1m;        proxy_pass http://a.b.c.d:8081/app/v2/$section;        proxy_http_version 1.1;        proxy_set_header Upgrade $http_upgrade;        proxy_set_header Connection 'upgrade';        proxy_set_header Host $host;        proxy_cache_bypass $http_upgrade;}


I've faced such problem with sockets.

In my case, it was solved by adding this in nginx.conf

map $http_upgrade $connection_upgrade {    default upgrade;    ''      close;}