Fix the HTTP/2 responses Chrome rejects on your website
ERR_
What Chrome rejects over HTTP/2
An uppercase header name
HTTP/2 requires header names in lowercase. A response carrying a name such as X-Cache with capitals, because a proxy or custom server sent it unchanged, is malformed, and Chrome refuses it.
A control character in a header value
Values can't contain line breaks or other control characters. A header built from user input, an error message or an unescaped string can carry one without anyone noticing.
A header left over from HTTP/1.1
Transfer-Encoding only describes a single HTTP/1.1 connection, and Chrome refuses an HTTP/2 response that carries it. HTTP/2 also marks Connection, Keep-Alive, Proxy-Connection and Upgrade as malformed. Chrome lets those through, but curl refuses them, so a proxy turning a backend's HTTP/1.1 response into HTTP/2 has to drop all five.
A header section over 256 KB
Chrome accepts up to 262,144 bytes of headers per HTTP/2 response, counting each name and value plus 32 bytes of overhead. Past that, the response fails with this error, not the too-big headers error HTTP/1.1 shows.
The server resets the stream
A server or proxy that gives up on a response sends RST_
STREAM with an error code such as INTERNAL_ ERROR. Chrome turns a reset into this error unless it's coded NO_ ERROR, REFUSED_ STREAM or HTTP_ 1_ 1_ REQUIRED, or it's a CANCEL or STREAM_ CLOSED that arrives after a complete response with a status of 300 or higher.
Chromium's header_
Compare HTTP/2 and HTTP/1.1 with curl
# Fetch the page over HTTP/2; curl prints an error line if the response breaks the rules
curl -sS --http2 -o /dev/null https://yoursite.com/
# Fetch it over HTTP/1.1 and print the response headers
curl -sS --http1.1 -o /dev/null -D - https://yoursite.com/
Read what curl prints
A clean HTTP/2 response prints nothing.
Invalid HTTP header field was receivednames the header curl refused, such as one with capitals or a transfer-encoding header. nghttp2, the library curl uses for HTTP/2, also refuses Connection, Keep-Alive, Proxy-Connection and Upgrade headers that Chrome accepts, so fix those, but keep looking if Chrome still fails. A stream reset shows asnot closed cleanlyorreset by server, depending on curl's version, followed by the error code, such as INTERNAL_ERROR. Both of those exit with code 92, which curl's manual describes as a stream error in the HTTP/2 framing layer. The HTTP/1.1 headers show the response without HTTP/2's rules applied. Capital letters and a Connection header are normal in HTTP/1.1, so use this output to judge sheer size and to spot odd characters in values or headers your app adds by hand. The HTTP/2 command is the one that shows whether a bad header made it through. If curl gets through cleanly but Chrome still fails, record the failure at chrome://net-export, as Chromium's NetLog guide describes. The log's HTTP/2 events name the header Chrome rejected or the reset it received.
How to fix an HTTP/2 protocol error
- Find the layer that speaks HTTP/2Chrome speaks HTTP/2 to whatever terminates HTTPS: your web server, a load balancer or a CDN. The bad response comes from that layer or from the backend behind it.
- Clean up the headersLowercase every header name, strip line breaks and control characters from values, and remove connection headers before responses go out over HTTP/2.
- Cut the header section downTrim large or repeated headers, such as a long run of Set-Cookie lines or a sprawling policy header, so the section stays well below 256 KB.
- Trace the stream resetsA reset is the server's own decision, so check its error log, and the log of any backend behind it, for the time of the failure. Fix the failure recorded there, such as a backend crash or timeout.
- Retest over both protocolsRun both curl commands again, then reload the page in Chrome and confirm it loads over HTTP/2.
Frequently asked questions
Should I turn off HTTP/2 to stop the error?
HTTP/2 is agreed during the TLS handshake (RFC 9113), so a server that stops offering it gets HTTP/1.1 requests instead. That hides the symptom: the bad header or failing backend is still there, and an oversized header section can then show ERR_
Why does only one page or file fail?
The problem lives in that response. A page that sets extra cookies, a route whose handler adds a malformed header, or a script whose backend errors partway can fail while the rest of the site loads. Test that exact URL with the curl commands above.
Why does Chrome say the page might have moved?
Chrome has no message of its own for this error, so it shows its default page, which says the site can't be reached and the page might be temporarily down. Chromium's error page code uses that wording for any error without a specific entry, and the error page strings hold the text. Nothing moved; the response broke HTTP/2's rules, or the server reset it.
Fix related response errors
- Website reliabilityHear about it when your site goes down, not days later from a customer.
- Response headers too bigMeasure your response headers, find the cookie or header that grew, and cut it back.
- Content decoding failedFind where the Content-Encoding label and the body bytes part ways, then fix that layer.
- 502 Bad GatewayFind the server behind your proxy that failed, then read the proxy's error log to see how.