Error Meteor, WebSocket, Nginx 502

We are trying to run the Meteor application on a Debian server for Nginx. The application is running, but GET requests at http://url/sockjs?info?cb=[random_string] return 502 Bad Gateway .

Nginx configuration is configured as follows:

 # this section is needed to proxy web-socket connections map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream app_server { server 127.0.0.1:3000; # for a web port socket (we'll use this first) # server unix:/var/run/app/app.sock; } server { listen 80; server_name app_server.com; charset utf-8; client_max_body_size 75M; access_log /var/log/nginx/app.access.log; error_log /var/log/nginx/app.error.log; location / { proxy_pass http://app_server; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP proxy_read_timeout 60s; keepalive_timeout 65; proxy_redirect off; # the root path (/) MUST NOT be cached if ($uri != '/') { expires 30d; } } } 

We tried various configurations and could not understand where the error was. Solution Error communicating with Meteor WebSocket 400 with nginx did not work either.

Edit: The following configuration went through, found in the recommended nginx configuration for the meteor , and it still returned 502.

Edit: The application works fine when it is not possible to get images from Meteor CFS, which is used to store downloaded images through the admin control panel. When uploading POST images to the / sockjs / img _location / cb / xhr_send domain, a 502 error is generated.

+7
nginx websocket meteor
source share
2 answers

Are you sure the problem really comes from NGINX and websocket?

  • You can try wcat first as a web site interface to provide webcams.
  • You can also try to run the application in the console or look at the log (debug / verbose at max level) to see if there is a main error
+2
source share

According to your editing question, CFS uses HTTP transport as a basic layer of data transfer.

Unfortunately, depending on how you get CFS on your stack, you may encounter an old and erroneous version of your dependencies, namely cfs:http-methods , which sometimes tries to complete an already completed answer, which then translates itself as cryptic error message.

Fortunately, the bug was resolved from version 0.0.30 and to ensure that Meteor downloads this version as a minimal dependency, all you have to do is edit the .meteor/packages file and add the following:

 cfs: http-methods@0.0.30 

Which will provide any version equal to or greater than 0.0.30, which is currently the latest in Atmosphere (meteorite packet server).

0
source share

All Articles