muaz-khan / RTCMultiConnection-Server

RTCMultiConnection socket.io server (npm install rtcmulticonnection-server)
https://muazkhan.com:9001/
MIT License
274 stars 146 forks source link

Nginx ProxyPass Unsupported protocol version #39

Closed 2gen closed 8 months ago

2gen commented 1 year ago

Hello,

We had an old server setup that ran RTCMultiConnection-Server on port 37022 and we proxypassed this through a domain using apache with following config:

RewriteCond %{QUERY_STRING} transport=polling [OR]
RewriteCond %{REQUEST_URI} /socket.io/socket.io.js
RewriteRule /socket.io/(.*)$ http://localhost:37022/socket.io/$1 [P]
ProxyPass /socket.io/ ws://localhost:37022/socket.io/
ProxyPassReverse /socket.io/ ws://localhost:37022/socket.io/

This is working. When we load the application we are seeing two requests to the IO server:

The first request replies with some text, 1:6 and the second establishes the socket connection and we can see messages back and forth.

We are now migrating to a nginx server that we need to replicate this on. We followed the instructions via the wiki but it doesn't seem to be working.

We are getting an error on the first request:

We think this is due to the first request needing to be a normal HTTP/S request and replying with the 1:6 data but instead nginx is attempting to upgrade this request to the socket.

We aren't sure how to configure NGINX. Does anyone have a working proxypass config for NGINX?

2gen commented 8 months ago

This was fixed by using version 2.3.0 of the socket.io package. Per the instructions at issue #28 this is resolved.