How do you fix Websocket error


I deployed my app to to a fresh digital ocean server using Meteor Up (mup) but I get this error all the time:

WebSocket connection to 'ws://' failed: Error during WebSocket handshake: Unexpected response code: 400

The app still works as expected (CRUD) but I think this error is causing my problems with me uploading files.

How can I fix this?


having the same issu =/


I’m having the same issue in Digital Ocean + Nginx + Meteor using MeteorUp tool :pensive:


I’ve removed kadira and it helped me. Try to remove or upgrade this package


I am using the exact same set up, no kadira in my setup. 1 thing is that my app still works fine but I do not know what is causing this error and would prefer to fix it


I solve my issue, in fact in my case it was the Cloudflare, and I solved following this post:


I have found that many servers don’t support websockets by default, in my case an EC2 instance im going to solve this probably by installing NGINX on it. I think we all have to check for that first on the server we using.


how to config server with websockets support?


Solution to this deployment error as well as other challenges related to HTTPS are most easily solved by using nginx as a reverse proxy. Short of it is external incoming connections from 80/443 (including websocket traffic) are intercepted by nginx which handles SSL/TLS … traffic is then simply forwarded to your meteor app which has become a nodejs app as a result of issuing :

meteor build --directory  /output/dir

On your server you run nginx + nodejs + mongo (as docker containers, or not )

Here is a working nginx.conf

# we're in the http context here
map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;

server {
    listen 80;
    listen 443 ssl http2;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers On;

    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key   /etc/letsencrypt/live/;

    ssl_session_cache shared:SSL:128m;

    add_header Strict-Transport-Security "max-age=31557600; includeSubDomains";
	add_header X-Content-Type-Options "nosniff" always;
	add_header X-Frame-Options "SAMEORIGIN" always;
	add_header X-Xss-Protection "1";
	# add_header Content-Security-Policy "default-src 'self'; script-src 'self' *";

	# add_header Content-Security-Policy "default-src 'self'";

    ssl_stapling on;
    ssl_stapling_verify on;

    # Your favorite resolver may be used instead of the Google one below

    # root /var/www/demo;
    # index index.html;

    # location '/.well-known/acme-challenge' {
        # root        /var/www/demo;
    # }

    location / {

        if ($scheme = http) {
            return 301 https://$server_name$request_uri;

		# proxy_pass;
		proxy_pass      http://localhost:3000;

		proxy_redirect off;
		proxy_intercept_errors on;

		#error_page 500 = /error_page.html;

		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

		proxy_http_version 1.1; # recommended with keepalive connections -

		proxy_set_header Upgrade $http_upgrade;
		# proxy_set_header Connection "upgrade";
		proxy_set_header Connection $connection_upgrade;
		proxy_set_header Host $host;  # pass the host header -



I am getting and error WebSocket connection to 'wss://*’ failed: Error during WebSocket handshake: Unexpected response code: 200 while running a meteor app on Centos Apache 2.2, the httpd conf is as follows
SSLEngine on
SSLProxyEngine On
ProxyRequests Off
ProxyPass / http
ProxyPassReverse / htp

RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* wss://localhost:8300/%{REQUEST_URI} [P]

the app runs on port 8300, and the domain is, i get this error only while accessing the site through https, if I go to everything is good. Please help, struggling with this for past 4 days :slight_smile:


I am having the same issues with websockets. But in my case my whole development machine is affected. Other web sites are slow to load and even slack has trouble updating. Other people in my group have noticed the same from time to time. The fix seems to be shutting off wifi and turning it back on.

I was wondering if others experience the same issues when these websocket problems start or if the websocket issue are a result of something else slowing down my machine. We use macs.