ERR_SPDY_PROTOCOL_ERROR Ajax.net web api

Making a very strange error while trying to make Ajax calls on a .NET Web Api hosted on IIS on Azure.

I have an SSL certificate that allows me to encrypt, it applies correctly to the website. When I try to make an ajax call, I get:

Net :: ERR_SPDY_PROTOCOL_ERROR

If Fiddler is open, everything works correctly. With closing Fiddler we get an error. The normal HTTP protocol is working fine.

+9
source share
4 answers

The solution for me was that Chrome strictly adhered to the authorization header format.

The header format is the token of the scheme , and it is important that there is no colon after the scheme. My old style code was in Bearer: thetoken , which is not Bearer: thetoken . I changed it to Bearer thetoken and now everything works correctly.

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

For me, the problem was that I sent an empty authorization header.

My application login (AngularJS SPA) sends the username / password in the JSON object, and if the login is valid, it returns a JWT, which is then used for the authorization header - for example, Bearer {JWT} for future API requests.

Not sending the authorization header when there was nothing to send fixed the problem.

+1
source

I had the same problem. The fix in my case was to update the authorization header to not include the JSON object when calling the API. Probably something that I should not have done in the first place .; -)

Example

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

I had the same problem. In my case, this happened because the API could not connect to SQL Server (because I stopped the service and forgot to restart it.) Yes, but still a more relevant error message would make the problem obvious in one second ... instead of many minutes: - |

0
source

Source: https://habr.com/ru/post/1270501/


All Articles