Invalidate URL cache with http header
Dridi Boukelmoune
dridi at varni.sh
Wed Jul 5 10:21:34 CEST 2017
On Wed, Jul 5, 2017 at 10:04 AM, Quintin Par <quintinpar at gmail.com> wrote:
>
> Nginx has a nifty command for invalidating a specific cache
>
> proxy_cache_bypass $http_cachepurge;
>
> curl -I myapp.example.com/api/ping -H "cachepurge: true"
>
> Is there something equivalent in varnish?
Hi,
I'm not familiar with this nginx feature, but there is a hash_always_miss
feature in Varnish that allows you to bypass a cache hit.
You can probably do something like this in vcl_recv{}, I haven't tried:
set req.hash_always_miss = req.http.cachepurge == "true";
However, this opens a DoS vector so you probably want to restrict this
using an ACL or other means.
Dridi
More information about the varnish-misc
mailing list