Varnish Cache CLI Purge Single File

varnish

These examples work to purge (first) a folder and the domain root

varnishadm -S /etc/varnish/secret -T localhost:6082 "ban req.http.host == mysite.com && req.url ~ ^/fold/.*$"
varnishadm -S /etc/varnish/secret -T localhost:6082 "ban req.http.host == mysite.com && req.url ~ ^/.*$"

How can I purge just one file " index2.html " (for example)

" …&& req.url ~ ^/index2.html$"

The above gives no error message, but doesn't work.

Edit: Retesting showed I originally had a typo when trying to work w/ the single file. The format (posted here) does work.

Best Answer

i have test the below ,it work fine for me. hope it helps.

/usr/local/bin/varnishadm "ban req.http.host == d.oozk.com && req.url ~ ^/wp-content/themes/twentyeleven/style.css"
Related Topic