- 🇳🇿New Zealand davidwhthomas
Thanks for adding this. You are absolutely right. The current ban expression does not support multiple cache tags and also has other spurious matches. I've tested your updated ban expression and it works well.
In most suggested Varnish configuration files, cache tag invalidation is performed by this expression:
ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
This is completely incorrect in case of multiple tags sent in one request (and this exactly how Varnish purgers send tags).
For example, if obj.http.Cache-Tags="node_list node:1" and req.http.Cache-Tags="node_list node:1 node:2", there will be no invalidation.
And if obj.http.Cache-Tags="node:123" and req.http.Cache-Tags="node:1", there will be unnecessary invalidation.
We need to split tags by spaces and allow each tag to appear either at line beginning or line end or be surrounded by spaces. The correct expression is
ban("obj.http.Cache-Tags ~ " + regsuball(regsuball(req.http.Cache-Tags, "([^ ]+)( +|$)", "((^|\\s)\1(\\s|$))|"), "\|$", ""));
(maybe it can be simplified, but at least it works properly).
Active
2.0
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks for adding this. You are absolutely right. The current ban expression does not support multiple cache tags and also has other spurious matches. I've tested your updated ban expression and it works well.