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

July 16, 2015 3.5k views
Node.js Nginx

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;
httpversion 1.1;
setheader Upgrade $httpupgrade;
proxysetheader Connection 'upgrade';
proxysetheader Host $host;
proxycachebypass $http_upgrade;