Problem/Motivation
CloudFront only stores the first 50 cache tags per cached object. When a response has more than 50 tags, CloudFront silently drops the excess. This means content associated with dropped tags won't be invalidated when those tags are purged.
Currently, tags are sent in whatever order Drupal provides them, with no control over which tags are prioritized when exceeding the limit.
Steps to reproduce
Proposed resolution
Introduce two swappable services for tag processing:
- CacheTagFilterInterface - Filters tags before they're added to the header. Default implementation uses the Purge blocklist.
- CacheTagPrioritizerInterface - Sorts tags so the most valuable are sent first. Default implementation prioritizes: entity tags (e.g.,
node:123) → list tags (e.g.,node_list) → other tags.
Entity tags are prioritized because they enable precise invalidation of specific content. List tags trigger broader invalidations and can be handled with shorter TTLs or path-based invalidation as a fallback.
Sites can override either service to implement custom filtering or prioritization strategies.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork cloudfront_purger-3589395
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
kim.pepperComment #6
kim.pepperCommitted to 2.x