Cache-Tag header limit is incorrect

Created on 7 February 2021, over 4 years ago
Updated 10 January 2024, over 1 year ago

Problem/Motivation

The Cache-Tag header is currently limited to 255 bytes:
https://git.drupalcode.org/project/cloudflare/-/blob/9aa28e567aa9124e985...

Upon further investigation, it looks like this limit is not used and every header value is hashed

@todo Remove this wrapper once CloudFlare supports 16k headers.

https://git.drupalcode.org/project/cloudflare/-/blob/9aa28e567aa9124e985...

Cloudflare now allows headers up to 16KB

Individual tags don’t have a maximum length, but the aggregate Cache-Tag HTTP header cannot exceed 16 KB after the header field name, which is approximately 1000 unique tags. Length includes whitespace and commas, but not the header field name.

https://support.cloudflare.com/hc/en-us/articles/200169246-Purging-cache...

Steps to reproduce

N/A

Proposed resolution

Remove the unused limit parameter and the header minification.

Remaining tasks

  1. Write Patch

User interface changes

None

API changes

Most response headers will be the actual tags

Data model changes

N/A

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States davidwbarratt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium mr.baileys πŸ‡§πŸ‡ͺ (Ghent)
  • πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

    Given the response header limitation for Cloudflare may have increased, it's very likely that upstreams will start hitting resource limitations now.

    Acquia is now capped at 8kb for their Cloud Next platform.

    https://docs.acquia.com/acquia-cloud-platform/known-issues-cloud-next#se...

    I think this almost has to be user-configurable (and enforced?) given all hosting is not equal.

  • πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

    A bit more info on Acquia Cloud Next here.

    Individual response headers are indeed limited to 8kb and exceeding this limit results in an immediate white screen of death. ☠️

    When splitting things into multiple headers, it appears that Acquia's infrastructure does not fail, but instead collapses the headers into a single one, comma-separating the values.

    For example:

    Cache-Tags: ...almost 8k of them, abcd
    Cache-Tags: dcba, ...the rest

    Is transformed into

    Cache-Tags: ...almost 8k of them, abce, dcba, ...the rest

    I don't know if this behavior is completely kosher with an RFC or not.

    Furthermore, the individual header limit on ACN seems to be slightly less than the advertised 8k. Casual testing indicates that things start failing at 8188 bytes. 🀷

Production build 0.71.5 2024