From what we've seen in the "regular" failed HTTP requests a status code of zero usually means two things:
- The server is down
- Authorization didn't happen.
In this case we saw the negotiation request sent, with an immediate failure. Our server was up and running and we had set up CORs. We were stumped.
Indeed the seemingly ubiquitous nefarious ugly and mystery error showed:
Failed to load resource: net:: ERR:SSL_PROTOCOL_ERROR
We see the Websocket failure in this trace:
Its content showed this:
Not much information here. Let's look at backend. The output window showed this interesting clue.
2020-06-10T09:50:48.3243364-05:00 | [Warning] Message: Authorization failed for at RouteEndpoint
This Error is instantly painful when it happens because the journey to solve it is difficult.
- This error does not deal with non secure requests. If you are running an http site, not https, websockets is still able to connect, so we know that SignalR works on both schemas. However, if you are running just http then be aware that you need to add redirect middleware.
We never figured the root cause of this error, but we did find a solution. We made sure our site was using HTTPs, this fixed the problem.