简体   繁体   中英

socket.io can't connect when clients are on different wifi (ip address)?

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/";
    }
}

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM