Good question! Don’t know, I’ve only tested it on 3!
Tested it now with Varnish 4.0.1 and got it working with this in the default.vcl:
acl invalidators {
"127.0.0.1"
"localhost";
"<servers_hostname>";
"<servers_ip>";
}
sub vcl_recv {
if (req.method == "PURGE") {
if (!client.ip ~ invalidators) {
return (synth(405, "Not allowed"));
}
return (purge);
}
}
EDIT: I couldn’t get this to work before i added my servers public IP in the authorized client list. Edited the post to fit the results in case it might help someone else.
I know I’m superlate to this party but you got this plugin working with the above (the typical purge block) on v4 themystic? I only ask because I’m looking at the varnishlog and it LOOKS like the plugin is trying to use X-Purge-Method: regex, which according to the varnish guys that only ever worked with bans and the plugin is sending it as a purge request?
https://github.com/dreamhost/varnish-vcl-collection/blob/master/lib/purge.vcl#L20
That’s how we get it to work right on DreamPress in order to flush the whole site.
Yea, I have that exact VCL setup and it is actually adding:
1424204803.726397 10 obj.http.X-Req-URL ~ /.* && obj.http.X-Req-Host == mydomain.com
to ban.list but it’s definitely not purging anything. curl -X PURGE http://domain.com DOES work fine and purges the homepage.
Does this work:
curl -X PURGE http://domain.com/.*
It appears that the dreamhost vcl file you linked to is for varnish 3.x, is that correct? I notice that adding in the appropriate pieces into varnish 4 config results in an error when restarting the varnish service.
The one I linked to? Yes. As I’ve repeatedly said, right now I don’t have a v4 VCL (we aren’t using it, and I’m not good enough at Varnish to build it out properly).