ERR_SPDY_PROTOCOL_ERROR Ajax .net web api

Viewed 3419

Running into a very strange error when trying to execute Ajax calls to a .NET Web Api hosted on IIS on Azure.

I've got my SSL cert from let's encrypt, it's applied to the website properly. When I try to execute an ajax call I get:

net::ERR_SPDY_PROTOCOL_ERROR

If Fiddler is open, all works properly. With Fiddler closed, we get the error. Regular old HTTP works just fine.

4 Answers

The solution for me was that Chrome was being strict on the format for the Authorization header.

The format of the header is scheme token, and its important that you don't include a colon after the scheme. My older style code had the format Bearer: thetoken, which was failing. I changed it to Bearer thetoken and now everything is working correctly.

headers: {
    'Authorization': 'Bearer ' + token
}

For me the issue was that I was sending an empty Authorization header.

The login to my app (an AngularJS SPA) sends a username/password in a JSON object, and if the login is valid then a JWT is returned which is then used for the Authorization header - e.g. Bearer {JWT} for future API requests.

Not sending an Authorization header when there was nothing to send fixed the issue.

I had this same issue. The fix in my case was updating the Authorization header to not include a JSON object when making the API call. Probably something I shouldn't have done in the first place. ;-)

Example

headers: {
    'Authorization': 'Bearer ' + accessToken
}

I had the same issue. In my case, it happened because the API failed to get a connection to SQL Server (because I had stopped the service and forgot to restart it.) Duh on me, but still, a more relevant error message would've made the problem obvious in one second...instead of many minutes :-|

Related