I need to purge or ban cache that has been modified by an unsafe request. I found a solution that appears to work for varnish 3.0; however I am on varnish 4. It seems this is no longer the correct syntax.
sub vcl_recv {
if ( req.request == "POST" || req.request == "PUT" ) {
ban("req.url == " + req.url);
return(pass);
}
}
It's giving me an error
Jun 26 17:43:21 test varnishd[2127]: Symbol not found: 'req.request' (expected type BOOL):
Jun 26 17:43:21 test varnishd[2127]: ('/etc/varnish/default.vcl' Line 13 Pos 10)
Jun 26 17:43:21 test varnishd[2127]: if ( req.request == "POST" || req.request == "PUT" ) {
Jun 26 17:43:21 test varnishd[2127]: ---------###########--------------------------------------
Jun 26 17:43:21 test varnishd[2127]: Running VCC-compiler failed, exited with 2
What can I do to make varnish purge/ban unsafe requests?
Thank You.