Peer5 / ShareFest

Web based p2p file sharing built on WebRTC Data Channels API
1.68k stars 271 forks source link

work behind nginx ssl proxy #80

Open bluenevus opened 9 years ago

bluenevus commented 9 years ago

I simply can't get it to work behind nginx ssl proxy. 1st I updated Sharefest so it works on the newest express. I'm happy to share that with everyone. I updated server.js with app.enable('trust proxy'); so that it can get the ip and connection from the client which it does. here is the nginx file...there is something I'm missing and I think its something in express from the server.js file but can't figure it out. Any help would be grateful.

----nginx setting proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true;

be carefull, this line doesn't override any proxy_buffering on set in a$

proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpPro$

        proxy_http_version 1.1;  # recommended with keepalive connections
        # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

    }

}

we're in the http context here

map $http_upgrade $connection_upgrade { default upgrade; '' close; }