Piotr M
Piotr M

Reputation: 509

signalr not working with https Error during WebSocket handshake: Unexpected response code: 200

I have backend that I use signalr for websockets. When client and backend were on http, everything worked.

Then I switched to https. Now I see this errors in browser:

WebSocket connection to 'wss://example.com/chatHub?id=mKk-uj0P0_7WsLFXjXhskA' failed: Error during WebSocket handshake: Unexpected response code: 200

POST https://example.com/chatHub?id=HSwLlWtJGpBP0Dib6sHobQ 404 (Not Found) 

The weirdes thing is, that even I see this errors, on Edge chat is working (on chrome and firefox not).

What is going on here and how can I fix that? client is angular 6 (@aspnet/signalr for hub connection) backend is dotnet

Edit: I forgot to mention, I have backend and client proxied with nginx.

Upvotes: 1

Views: 2035

Answers (1)

Piotr M
Piotr M

Reputation: 509

Turns out it was issue with nginx.

proxy_set_header  Upgrade $http_upgrade;
proxy_set_header  Connection "Upgrade";

on server nginx.conf fixed issue

Upvotes: 2

Related Questions