SignalR: Error during WebSocket handshake: Unexpected response code: 400

后端 未结 5 2034
旧巷少年郎
旧巷少年郎 2020-12-31 04:22

I have just started working with SignalR. I have implemented real-time data reflection on my site using signalr. I was getting \"Error during Web-Socket handshake: Unexpecte

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 05:05

    If you're behind Nginx, add these three lines (the ones starting with proxy_):

    server {       
        listen       443; # Or 80 or whatever
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        ...
    }
    

    HTTPS/HTTP is not the issue. WSS will be automatically used on HTTPS pages, and WS used on HTTP, without any manual setting.

提交回复
热议问题