muaz-khan / RTCMultiConnection-Server

RTCMultiConnection socket.io server (npm install rtcmulticonnection-server)

Home Page:https://muazkhan.com:9001/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About reverse proxy

opened this issue · comments

Hello Muaz,

First-- Thank you very much for your project.

I was wondering if you might be able to help me set this server up with a reverse proxy on Nginx. I am using Let's encrypt certificates that auto-renew.

Am I able to run the RTCMultiConnection-server in HTTP, then load the certificates through nginx? Or do I have to specifically set the cert/key inside of the application in order to work in a production RTCMultiConnection (https) environment? I haven't been able to connect to socket.io this way. I was using a URL like https://server.com/signal/. Is that allowed, also?

Thank you for your time.

Mark

Socket.io (currently) runs on the same port where we invoke http.createServer or https.createServer methods. By default it is 9001 however you can always change to port 443 or 80 (via config.json).

On heroku, we're using HTTP along with process.env.PORT which is something like 58757 (heroku run bash can show that port). However heroku server is listening it on 443 (HTTPs). So they must be using reverse proxy to move traffic from 443 to process.env.PORT on the server side. Amazon EC2 maybe using same.

I'll test further to see how to implement similar thing on non-heroku websites.

Thank you for the reply Muaz. After bashing my head against it for a little bit, I was able to figure out my problem. I was putting too much emphasis on "socketURL": "/",

It eventually clicked that you can put whatever you want, it just has to match the client side socketURL. So I started the signal server as http, did a reverse proxy to a "rtc" https subdomain, and I was able to
connect successfully. Now I am working to port the admin panel to my project as well, I don't see any issues so far!

Thanks again for your great project. I'm going to close this, as it was never really an issue, and more of a misunderstanding.

Have a great rest of your week!