0

socket.io can't connect when clients are on different wifi (ip address) on my self-configured ubuntu nginx server, but works perfectly fine on a pre-configured heroku server

this is my nginx config

upstream dirtyfinger {
    ip_hash;
    server localhost:3000;
    server localhost:3001;
    server localhost:3002;
    server localhost:3003;
}
server {
    listen 80;
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass "http://dirtyfinger/";
    }
}
tga
  • 538
  • 4
  • 15

1 Answers1

0

Change this: proxy_pass "http://dirtyfinger/";

To this: proxy_pass http://dirtyfinger/;

And potentially lose the end '/', though I am not 100% on that.

Docs: https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/

Oliver
  • 9
  • 2
  • thanks but this doesn't solve the socket.io connection problem – tga Jun 24 '18 at 17:10
  • Looking around some more there is another question regarding this [here](https://stackoverflow.com/questions/29043879/socket-io-with-nginx). How are you reaching the site via your ubuntu nginx server vs the heroku setup? Can you post some additional information? – Oliver Jun 24 '18 at 17:35
  • the application code are completely the same, the only difference is i'm running my own configured nginx server vs don't know how heroku is running my app which works fine – tga Jun 24 '18 at 17:38
  • Can you add the nginx logging and post the logs from both? https://docs.nginx.com/nginx/admin-guide/monitoring/logging/#setting-up-the-access-log – Oliver Jun 24 '18 at 17:49