tagyoureit / nodejs-Pentair

An application to read/write to Pentair pool controllers.
14 stars 6 forks source link

wss (WebSocket) Handshake Issue #58

Closed arrmo closed 7 years ago

arrmo commented 7 years ago

Finally! ... :). I have Proxy through Apache working - just two minor things, 1) Need to include PR #57 - minor changes to paths, still works with Express (checked locally at least) 2) One minor issue open (this issue) ... wss message as below. Any thoughts? Everything seems to work fine, but would be good to clean it up.

WebSocket connection to 'wss://mysite.com/socket.io/?EIO=3&transport=websocket&sid=BCtAVuUqW75CroKPAABH' failed: Error during WebSocket handshake: Unexpected response code: 400

FYI, here is the Apache config updates ... then Apache will redirect (Proxy), and external access no longer needs a special port opened! The trailing slash thing still bothers me, but very minor ... ;). SSLProxyEngine On ProxyPreserveHost On ProxyRequests Off RewriteEngine On

Trailing slash seems to be needed -> keep for now.

            RewriteRule ^/nodejs$ /nodejs/ [R]
            ProxyPass        "/nodejs/" "https://localhost:3000/"
            ProxyPassReverse "/nodejs/" "https://localhost:3000/"
            ProxyPass        "/socket.io/" "https://localhost:3000/socket.io/"
            ProxyPassReverse "/socket.io/" "https://localhost:3000/socket.io/"
arrmo commented 7 years ago

OK, found the fix - so closing this. Fix is below (apache config file), RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) wss://localhost:3000/$1 [P,L]