Shrink the response headers Chrome refuses on your website

ERR_RESPONSE_HEADERS_TOO_BIG means the headers your server sent with a response were bigger than Chrome will read, so Chrome dropped the response before reaching the page. Over HTTP/1.1 Chrome stops at 256 KB of headers. On your own site, look for a pile of Set-Cookie lines, a header repeated by a loop or by several layers, or a debugging or policy header that grew out of control.

What makes response headers grow

  • Too many or too large cookies

    Every cookie the server sets is a separate Set-Cookie header. Storing data in cookie values, setting a cookie per feature or setting the same cookie several times in one response all add up.

  • One header repeated many times

    Code that adds a header inside a loop, or several layers that each add the same header, can repeat it until the section balloons past anything a normal page needs.

  • Debug data sent as headers

    Headers that carry debugging output, such as timings or log lines, can outgrow everything else in the response when they're left switched on in production.

  • A policy or link header that kept growing

    A Content-Security-Policy that lists every domain the site has ever used, or a long run of Link headers, adds bulk to every response the site sends.

Chromium's http_stream_parser.h caps HTTP/1.1 response headers at 256K, and http_stream_parser.cc returns ERR_RESPONSE_HEADERS_TOO_BIG once a response passes it. Over HTTP/2, http_network_session.h sets a limit of 256 * 1024 bytes, and going over it shows ERR_HTTP2_PROTOCOL_ERROR instead. RFC 9110 sets no limit of its own and notes that implementations set their own.

Measure the headers your server sends

# Count the bytes in the response headers over HTTP/1.1
curl -sS --http1.1 -o /dev/null -D - https://yoursite.com/ | wc -c

# Count the Set-Cookie headers in the response
curl -sS --http1.1 -o /dev/null -D - https://yoursite.com/ | grep -ci '^set-cookie:'

# List the longest header lines with their names
curl -sS --http1.1 -o /dev/null -D - https://yoursite.com/ | awk '{ print length($0), $1 }' | sort -rn | head

Read the numbers

Chrome's HTTP/1.1 limit is 256K, or 262,144 bytes, for the whole header section, so a byte count near or over that number explains the error. curl has a limit of its own, 300 KB of response headers in all, set in its source, so if the commands stop with Too large response headers, the section is past Chrome's limit as well and the counts are partial. The Set-Cookie count shows whether cookies make up the bulk, and the longest lines and the names that repeat most show what to cut first.

How to shrink oversized response headers

  1. Find the layer adding the headersCompare headers from your app server directly with headers from the public address. A layer that adds headers your app never sent is where to look.
  2. Trim the cookiesDrop cookies the site no longer uses, keep session data on the server with only an ID in the cookie, and set each cookie once per response.
  3. Stop repeated and debugging headersFix the loop or the duplicate rule that repeats a header, and turn off debugging headers on the production site.
  4. Check both protocols afterwardMeasure again, then load the page in Chrome. Over HTTP/2 the same oversized headers show as ERR_HTTP2_PROTOCOL_ERROR, so confirm the fix holds for both.

Frequently asked questions

How big can response headers be in Chrome?

262,144 bytes for the whole header section over HTTP/1.1, written as 256K in Chromium's http_stream_parser.h. Over HTTP/2 the limit is the same number of bytes, but counted as each header's name and value plus 32 bytes, the overhead RFC 9113 defines.

Is this the same as a 431 error?

No. A 431 means the server refused the headers your browser sent. ERR_RESPONSE_HEADERS_TOO_BIG is the reverse: Chrome refusing the headers the server sent back. Cookies can cause both, but one is fixed in what the browser stores and the other in what your server sends.

Why do only some visitors get the error?

The big headers may only appear in their responses, for example after they sign in or once a feature sets extra cookies for them. Sign in with a test account of your own, put it in the same state, and add its cookies to the curl commands with -H 'Cookie: ...' to measure a response the way those visitors get it.