varnish_purge_tags : handle special cases when a lot of cache tags on a page will generate a very Large http header

Created on 30 October 2023, about 1 year ago
Updated 6 November 2023, about 1 year ago

Problem/Motivation

When enabled, the sub-module varnish_purge_tags adds drupal cache tags to http responses in a custom http header named "Cache-Tags".
In some situations, the number of cache tags for a page can be really big, and exceed the limit supported by other systems in front of the drupal website : Apache, Varnish, Nginx...etc
When this problem occurs, it may be quite hard to identify, especially from the Drupal point of view. While in some situations, the maximum size of http header values can be increased, this my not always be the possible or desired (security concerns?).
There should be a workaround, or at least a warning message emitted when such situation occur.

Steps to reproduce

For example, if you have a drupal website with a lot of nodes and you create a sitemap page with the sitemap module.

Proposed resolution

There are different possibilities to deal with this situation, but some of them can break the desired functionnality :
- (a) Just emit a warning the size of the generated "Cache-Tags" header is above a certain value (ex: 8kb).
- (b) limit the size of the generated "Cache-Tags" headers by varnish_purge_tags module : this can cause problems during cache tags
invalidation triggered from varnish purgers if some tags are missing from http responses.
- (c) rewrite the generated "Cache-Tags" header value when it is above a certain value (ex: 8kb) to be less specific. For example, replace all the cache tags node:XX node:YY by the associated list cache tag "node_list"

The (c) approach is the one i would like to suggest and debate.
I don't know if patching the varnish_purge_tags module is the right/best approach.
The usage of an additional custom module may be more accurate to use specific list tags or restrict this behavior only on specific urls.

but what about adding a mechanism in this module or another contrib module to handle those cases?

what do you think ?

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France just_like_good_vibes PARIS

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

Comments & Activities

Production build 0.71.5 2024