question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

when I use https,it case 'Error during WebSocket handshake: Unexpected response code: 400'

See original GitHub issue

When I use http protocol no problem happened,but then I deploy my project on https protocol,it case ‘Error during WebSocket handshake: Unexpected response code: 400’,How to solve this problem? This is my nginx Config.

upstream site {       
    server 127.0.0.1:3000;
}
server {
    listen 443;
    charset     utf-8;
    client_max_body_size 75M;
    ssl on;
    ssl_certificate  /etc/nginx/ssl/site_cert.crt;
    ssl_certificate_key  /etc/nginx/ssl/site.key;

    location / {
         include proxy_params;
         proxy_pass_header Server;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Scheme $scheme;
         proxy_pass http://site;
    }

    location /socket.io {
        include proxy_params;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://site/socket.io;
    }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
bgschillercommented, Feb 21, 2018

I was facing this issue when using Elastic Beanstalk and an AWS load balancer.

Websockets travel over tcp, not http, so we needed to tell the load balancer to forward raw tcp instead of operating at the http layer.

Sorry to comment on a closed issue, but I hope this is helpful for some people.

10reactions
himanshu-signcatchcommented, Aug 24, 2017

@jarrai Hi, I am facing the same issue. Can you elaborate on how you rectified it? Thank You

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket connection failed: Error during ... - Stack Overflow
WebSocket connection failed: Error during WebSocket handshake: Unexpected response code: 400 · Ask Question. Asked 5 years, 11 months ago.
Read more >
Error during WebSocket handshake: Unexpected ... - GitHub
Error during WebSocket handshake: Unexpected response code: 400 #1942 ... the lack of sticky session, in case you are using several Socket.
Read more >
Error during WebSocket handshake: Unexpected response ...
WebSocket connection to 'wss://my_domain/openvidu' failed: Error during WebSocket handshake: Unexpected response code: 400. How can I fix this error?
Read more >
Error during WebSocket handshake: Unexpected response code
Error during WebSocket handshake : Unexpected response code: 400. Hi,. I'm getting the following error when trying to update the data using websocket...
Read more >
Got connection failed: Error during WebSocket handshake ...
... Error during WebSocket handshake: Unexpected response code: 400 ... It's work fine in Unity Editor, but failed to make a WebSocket ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found