mirageglobe
mirageglobe

Reputation: 3134

Demeteorizer compiles meteor app and causes WebSocket connection error?

I have node running behind nginx. On local test server my meteor app works fine (I am using default meteor installation). When this app is demeteorized, and uploaded to the server (I am using Nginx+node), the error occurs part of the script.

The application is fine but the datareads are blocked. any suggestions?

WebSocket connection to 'ws://www.all**.com/sockjs/867/rfk8snwm/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

Many thanks in advance.

Upvotes: 2

Views: 744

Answers (1)

Serkan Durusoy
Serkan Durusoy

Reputation: 5472

Quoting from meteorpedia:

For websockets support on nginx, you need version >=1.4 an use the configuration below:

location /sockjs/ {
        proxy_pass http://APP_LOCATION;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
}
  • Replace APP_LOCATION with your proxy server definition or url or whatnot.
  • The Upgrade/Connection lines allow for WebSockets support.

If you are unable to upgrade your nginx installation to 1.4 or later, then you need to explicitly disable websockets from within meteor by setting the following environment variable on your system:

DISABLE_WEBSOCKETS=1

This will ensure proper bypass of websockets in favor of the sockjs fallback.

Upvotes: 3

Related Questions