DEV Community

Srinivas for ItsMyCode

Posted on • Originally published at on

[Solved] err_http2_protocol_error

ItsMyCode |

The err_http2_protocol_error occurs for various reasons while using Ng, and it’s one of the most annoying errors that appear all of a sudden either on your browsers such as Chrome, Firefox, etc. It can happen when you make HTTP calls from your code using react, .net, node.js, etc.

Solution err_http2_protocol_error

Let’s look at the typical use case and the solution for each of the different use cases.

Scenario 1: Low Disk Space

If your webserver runs on very low disk space, you will get err_http2_protocol_error while making HTTP calls. The error won’t be logged anywhere sometimes as there is no space left out on the disk.

The webservers like Nginx, apache webservers will be unable to send all the responses and usually drop the request after the first chunk is sent. This would result in the content-length header not matching the actual content received and resulting in err_http2_protocol_error.

Solution: Check the disk space on your webserver, free up space, and check if this resolves the issue.

Scenario 2: Gzip double compression

If you are running Node.JS on an Nginx server, then there are high chances that the files like CSS, js, etc are getting double compressed, and due to which err_http2_protocol_error is thrown.

The first compression happens on the Node.JS server for the static files, and then even the Ngxinx also does Gzip conversion.

Solution : Turn off the gzip compression on the Nginx config as shown below. Always ensure the gzip compression happens only once on the server-side.

 server {
  gzip off;
  proxy_max_temp_file_size 0;
  location / {
Enter fullscreen mode Exit fullscreen mode

Also, it can cause because of the header size issue. Increase the value of http2_max_field_size and http2_max_header_size to resolve the issue.

http2_max_field_size 64k;
http2_max_header_size 512k;
Enter fullscreen mode Exit fullscreen mode

Scenario 3: Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR after upgrading to VS 2019 16.10.0 (and 16.10.1)

The issue can happen if you are running ASP.Net 3.1 + React JS app after a windows update.

It is an official bug from Microsoft Windows, and it’s confirmed by Microsoft officially.

Solution : Uninstalling a recent Windows patch, *KB5003637 * resolves the issue, or you can upgrade to the latest version of the Windows patch.

The post [Solved] err_http2_protocol_error appeared first on ItsMyCode.

Discussion (0)