Error : net::ERR_INVALID_HTTP_RESPONSE in chrome browser response

Issue Description

“net:: ERR_INVALID_HTTP_RESPONSE” in Net Core 2.2 WebAPI invocation within Chrome browser or noticeable when if invoked with Angular Http services.

This error is also noticeable when .NET Core 2.2 WebAPI is invoked within UI framework like Angular (5,6 or 8) or Vue or React.js using Chrome browser.

Also API returns proper HTTP Status code and response using SOAP UI or Postman apps show proper 200 OK response but the browser shows the above error.

Today in this article, we will cover below aspects,

Resolution 1

This issue is reproducible with below version of .NET Core SDK

.NET Core SDK version with Issue,

  • 2.2.100
  • 2.2.101

.NET Core version with the resolution,

  • 2.2.105 and above is recommended.

So if you want to fix the issue, please use version 2.2.105 and above.

I have personally verified version 2.2.105 on my machine and found to be working fine. The issue might not be reproducible for other versions of the .NET Core SDK like 103 or 104, I could not verify that but surely please check and confirm from your side.


Resolution 2

But please check and confirm if this option is feasible for your project.

The above error will go away if downgraded to .NET Core 2.1 version.

Other Workarounds

There are other workarounds as well for the given issue which is explained below,

Open Startup.cs file of target WebAPI application and update the Configure() method as below. This simple middleware component in API pipeline helps to resolve the issue.

Did the above steps resolve your issue? Please sound off in the comments below!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

Your email address will not be published. Required fields are marked *