Question

"Cannot GET" on reverse proxy via Nginx to socket.io

Posted July 16, 2015 20.6k views
Nginx Node.js

I’ve followed this great tutorial to get Node.js working on through Nginx on a two Ubuntu 14.04 droplets via private networking - that part works fine. However, when I try and run up the fantastic chat application in socket.io, it works when I access it directly (http://mypublicappserver:3000) but, when I try and access it via my Nginx proxy (http://mywebserver/node), I get “Cannot GET /node” in the browser and in the firebug console “
"NetworkError: 404 Not Found - http://mywebserver/node”. If I curl http://myprivateappserver:3000, I get index.html from my socket.io application fine. I’d be very grateful for any pointers on what to try next.

My /etc/nginx/sites-available/default contains:

location /node{
proxypass http://myprivateappserver:3000;
proxy
httpversion 1.1;
proxy
setheader Upgrade $httpupgrade;
proxysetheader Connection ‘upgrade’;
proxysetheader Host $host;
proxycachebypass $http_upgrade;
}

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer
Submit an Answer