[Wordpress]homepage not purging (Everton Blair)
Laurence Rowe
l at lrowe.co.uk
Sat Jul 9 01:08:01 CEST 2011
On 8 July 2011 20:04, Everton Blair <everton at connectedinternet.co.uk> wrote:
> Can anyone help me with my problem please? It's been causing me major
> problems. Basically I'm using Wordpress and new posts have been forcing the
> homepage to purge, I think because I'm using a special template within
> wordpress to create the homepage and I think Varnish doesn't realise it
> needs to purge that page
> What I want to do is force varnish to purge my homepage when any purge
> requests come in to make sure it stays fresh and to be safe, but I can't get
> this to work:
> sub vcl_recv {
> if (req.request == "PURGE") {
> if (!client.ip ~ purge) {
> error 405 "Not allowed.";
> }
> if (req.url == "^windows7news.com/$") {
> purge(HOW DO I TELL VARNISH TO PURGE
> http://www.windows7news.com/magazine-homepage/ ????);
> }
> if (req.url == "^windows8news.com/$") {
> purge(HOW DO I TELL VARNISH TO PURGE
> http://www.windows8news.com/magazine-homepage/ ???);
> }
> return(lookup);
> }
> }
> Thanks for any help.
Remember that req.url is only the path of the request, it does not
include the entire hostname (except sometimes when you use curl, but
just ignore that for now.)
Assuming Varnish 2.1 you want something like:
purge("req.host == " req.http.host " && req.url == /magazine-homepage/");
See: https://www.varnish-cache.org/trac/wiki/VCLExamplePurging
Laurence
More information about the varnish-misc
mailing list