Fix net::ERR_HTTP2_PROTOCOL_ERROR - Troubleshooting Browser Resource Loading

intermediate🌐 Networking2026-06-03| Linux (Ubuntu/CentOS), Nginx 1.9.5+, Google Chrome, Microsoft Edge

Error Message

net::ERR_HTTP2_PROTOCOL_ERROR
#http2#networking#browser#nginx

The Scenario: When Resources Suddenly Stop Loading

You're building a web app or loading a page when several resources—CSS files, JavaScript bundles, images—simply refuse to load. The browser's developer console shows something like this:

GET https://example.com/assets/main.js net::ERR_HTTP2_PROTOCOL_ERROR

This one stings more than a 404. A 404 means the file isn't there. This error means the browser and server started talking via HTTP/2, then something went wrong mid-stream. The communication channel itself broke. That ambiguity is what makes it hard to debug.

Why Does This Happen?

The error is a catch-all for several different root causes. In practice, it comes down to four main culprits:

  • Header Size Limits: Cookies are bundled into request headers. If your app stores more than 8 KB worth of data in cookies, the HTTP/2 header can exceed Nginx's allowed buffer size.
  • Nginx Proxy Buffering: When Nginx proxies a backend, it buffers the response. Default buffers (typically 4 × 8 KB) are too small for large API responses, causing the stream to terminate early.
  • Disk Space: Nginx writes overflow to a proxy_temp directory. A full disk kills that write, and the HTTP/2 stream crashes with it.
  • Outdated Software: Nginx versions before 1.14 had real bugs in the HTTP/2 stack. If you're still on one of those, upgrade first—before touching any config.

Step 1: Quick Fixes (Client Side)

Start here before touching server config. Browser state causes this error more often than you'd expect.

Clear Browser Cache and Cookies

Bloated cookies are a classic trigger. Open the site in an Incognito or Private window. If it loads there, your cookies are the problem—clear the site data and try again.

Check Browser Extensions

Ad-blockers, VPN extensions, and security tools can all interfere with the HTTP/2 stream. Disable them one by one, then reload. It takes 30 seconds and rules out a whole class of issues.

Step 2: Server-Side Fixes (Nginx Configuration)

For most production setups, Nginx configuration is where the real fix lives. Start with header buffers, then move to proxy buffers if needed.

Increase Header Buffer Sizes

Add these directives to your http, server, or location block. The config file is usually at /etc/nginx/nginx.conf or /etc/nginx/sites-available/default:

http {
    # ... existing config ...

    # Increase the allowed size for HTTP/2 headers
    http2_max_field_size 16k;
    http2_max_header_size 32k;

    # Also increase general header buffers
    large_client_header_buffers 4 32k;
}

Note for Nginx 1.25.5+: The http2_max_field_size and http2_max_header_size directives were removed when the HTTP/2 module was rewritten in that release. On those versions, large_client_header_buffers is the only knob you need.

Adjust Proxy Buffer Settings

Proxying a backend like Node.js or Python? The default buffer is tiny—just 4 × 8 KB. A single API response returning a 500 KB JSON payload blows past that instantly. When the buffer fills, Nginx drops the HTTP/2 stream.

location / {
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    proxy_pass http://your_backend;
}

Step 3: Checking the Environment

Configuration fixes won't help if the problem is environmental. Two things to check: disk space and Nginx version.

Verify Disk Space

Nginx writes large responses to a temp directory under /var/lib/nginx. A full partition means the write fails, and the HTTP/2 stream crashes immediately. Check with:

df -h

Any partition at 100% is an immediate red flag. A busy server can accumulate several gigabytes of access logs in /var/log/nginx/ within a week—rotate or clear them to free space fast.

Check Nginx Version

Early HTTP/2 implementations had genuine stability bugs. Anything before 1.14 is worth upgrading regardless of this error. Check what you're running:

nginx -v

As of 2024, Nginx 1.26.x is the current stable branch. If you're more than two major versions behind, the upgrade alone may resolve the issue.

Step 4: Verification

Never restart Nginx without testing the config first. A syntax error will take the server down.

sudo nginx -t

A clean result looks like: nginx: configuration file /etc/nginx/nginx.conf test is successful. Then reload the service:

sudo systemctl reload nginx

Confirm the fix from the command line using curl with the --http2 flag:

curl -I --http2 https://example.com/assets/main.js

You want HTTP/2 200 in the response. Anything else means the stream is still failing somewhere.

Networking Tips and Prevention

Protocol errors sometimes trace back to the network layer, not the application. MTU mismatches, for example, can fragment HTTP/2 frames in ways that look identical to a Nginx buffer problem. If you've adjusted all the Nginx settings and the error persists, check whether it reproduces on a direct connection—bypassing any VPN, load balancer, or CDN layer.

In VPC setups where traffic passes through multiple hops, miscalculated subnets can introduce routing overhead that surfaces as protocol-level failures. A Subnet Calculator is handy for verifying your CIDR ranges are correct before you spend another hour tweaking Nginx buffers.

The short version: keep cookies under 4 KB, size your proxy buffers to match real response sizes, and stay current on Nginx. Do those three things and you'll rarely see this error again.

Related Error Notes