Skip to content

Commit

Permalink
https://github.com/vegandthecity/server/issues/14
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed May 11, 2020
1 parent 0284673 commit 0bfb1a7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions etc/varnish/magento.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,32 @@ sub vcl_recv {
return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
}
if (req.http.X-Magento-Tags-Pattern) {
# 2020-05-12
# «`ban(STRING)`
# Invalidates all objects in cache that match the given expression with the ban mechanism.
# The format of STRING is:
# `<field> <operator> <arg> [&& <field> <oper> <arg> ...]`
# `<field>`:
# `obj.http.*`: Any cache object header
# `obj.status`: The cache object status
# `req.http.*`: Any request header
# `req.url`: The request url
# `<operator>`:
# `==`: <field> and <arg> are equal strings (case sensitive)
# `!=`: <field> and <arg> are unequal strings (case sensitive)
# `~`: <field> matches the regular expression <arg>
# `!~`: <field> does not match the regular expression <arg>
# `<arg>`:
# Either a literal string or a regular expression.
# Note that <arg> does not use any of the string delimiters like " or {"..."}
# used elsewhere in varnish.
# To match against strings containing whitespace, regular expressions containing \s can be used.
# Expressions can be chained using the `and` operator `&&`.
# For `or` semantics, use several bans.
# The unset <field> is not equal to any string, such that, for a non-existing header,
# the operators `==` and `~` always evaluate as `false`,
# while the operators `!=` and `!~` always evaluate as `true`, respectively, for any value of <arg>. »
# https://varnish-cache.org/docs/6.1/reference/vcl.html#vcl-7-ban
ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
}
if (req.http.X-Pool) {
Expand Down

0 comments on commit 0bfb1a7

Please sign in to comment.