0

I get the following log lines with each connection:

info: handshake authorized bQumvCf9KtcMVUoXcXG5 
warn: websocket connection invalid
info: transport end (undefined)

And the Apache2 error log shows this at the same time:

[Sun Apr 06 15:09:16 2014] [error] [client 24.84.162.51] (20014)Internal error: proxy: error reading status line from remote server localhost:7000
[Sun Apr 06 15:09:16 2014] [error] [client 24.84.162.51] proxy: Error reading from remote server returned by /socket.io/1/websocket/bQumvCf9KtcMVUoXcXG5

Is there something I can do in Sails to adjust the socket.io behaviour? I mean, pages are loading, and things appear to be connecting up, but something is clearly unhappy, and I'm always nervous when my log files aren't silent. Aren't you?

RSAdmin
  • 419
  • 1
  • 6
  • 20
  • Perhaps [this answer](http://stackoverflow.com/a/16998664/345484) about proxying Websockets over Apache would be useful? – sgress454 Apr 07 '14 at 05:16

1 Answers1

1

If you're not using socket.io then you probably wont notice any issues other than socket.io complaining that it can't connect.

However, proxying a websocket can be tricky. I haven't ever done it with apache but NGINX 1.3 added support for websockets. If it's helpful to you or others here is an NGINX config that will proxy a websocket

server {
        listen 80;
        server_name www.example.com;

        location / {
                proxy_pass  http://myserver:8000/;
                proxy_http_version  1.1;
                proxy_redirect  off;

                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;
                proxy_set_header  Upgrade  $http_upgrade;
                proxy_set_header  Connection  "Upgrade";
        }
}
InternalFX
  • 1,475
  • 12
  • 14