Question

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

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{ proxy_pass http://myprivateappserver:3000; 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; }

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.