[Wordpress]homepage not purging (Everton Blair)

Everton Blair everton at connectedinternet.co.uk
Fri Jul 8 21:04:40 CEST 2011


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.


On Fri, Jul 8, 2011 at 11:46 AM, <varnish-misc-request at varnish-cache.org>wrote:

> Send varnish-misc mailing list submissions to
>        varnish-misc at varnish-cache.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> or, via email, send a message with subject or body 'help' to
>        varnish-misc-request at varnish-cache.org
>
> You can reach the person managing the list at
>        varnish-misc-owner at varnish-cache.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of varnish-misc digest..."
>
>
> Today's Topics:
>
>   1. Re: Does Varnish uses ETag? (Geoff Simmons)
>   2. Fwd: [Wordpress]homepage not purging (Everton Blair)
>   3. Re: errno = Connection reset by peer (Tollef Fog Heen)
>   4. Re: Varnishstat question (Tollef Fog Heen)
>   5. Possible bug with very large headers in varnish-3.0.0
>      revision 3bd5997 (Lee Trout)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 08 Jul 2011 12:23:54 +0200
> From: Geoff Simmons <geoff at uplex.de>
> To: Kurt Kraut <listas at kurtkraut.net>
> Cc: varnish-misc at varnish-cache.org
> Subject: Re: Does Varnish uses ETag?
> Message-ID: <4E16DABA.2050606 at uplex.de>
> Content-Type: text/plain; charset=ISO-8859-1
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 7/7/11 11:14 PM, Kurt Kraut wrote:
> >
> > Does Varnish used ETag to check cache freshness?
>
> Mainline Varnish doesn't, but there's an experimental branch
> 'experimental-ims' on the source repository in which it's implemented.
>
> > - If yes, how does it behave?
>
> http://www.varnish-cache.org/trac/wiki/BackendConditionalRequests
>
> As per the RFC, freshness checks against ETags are done with conditional
> requests to the backend using If-None-Match.
>
> > - If not, is it possible to achive through VCL?
>
> I don't think so, because standard VCL doesn't have a way to access an
> object in the cache that has an expired TTL, but otherwise matches the
> request, and hence could be refreshed.
>
> So you don't ordinarily know an ETag in VCL that could be used for the
> refresh, and even if you did, and got a 304 response from the backend,
> there's no way to tell Varnish to deliver the stale object after all.
>
> If you get a chance to try the IMS branch, please let us know how it goes.
>
>
> Best,
> Geoff
> - --
> UPLEX Systemoptimierung
> Schwanenwik 24
> 22087 Hamburg
> http://uplex.de/
> Mob: +49-176-63690917
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBCAAGBQJOFtq5AAoJEOUwvh9pJNURIy4QAKPiZ05kblNGfw7RFJo5Z9fg
> 81feHHYKRy880yJrG9up8wNx02+9uku6gNlYkpkPcQqfP/fZu5PpUtjGK7pmCSWG
> Jv0bBEL+j5V2L0SaQtoxyyvBkQ5bjQcmrZnuxpYRKRdZeNpjIWY1BLHjMkC3z+sS
> 4KKPi1aiGTKYQH8O1FZHz+6dfP8OQseUCs7tLwYM2BYF2onh5H81ys/Adp6520lv
> WV2cJWKJO85MqH5C0qmyzGV3ovTFPaU3J4/4idzPxW/vbUDozr5/XjloG7IYzCi6
> Hj5YrfoJlqBREqdAdZ46G/cxS4dKmvMWIO8XaJIYMBISDaXQysXfLq9vLiqODD5l
> /1/ijFfEWihwdoxJ/xi1ZgxhA8RYuxQQCMtStVch+QiHpp8ROw04GutXFmA67JeM
> aWIBt9WL/cXc/YSP2geSobY89/ROulnKcqV9n5xvxGe1L2bkwq1jQJTtINF6l1oC
> lBb9tZAA2JGEeJi8Fv9lcjcrMiLSPzoW16rbzpQNjxxu129Rq8ntteFkm5cqM4sD
> 2do8CvRO3YauIY6bUGhRVSjNHCvYf6HvvoZEoKvgJy5drziKyU3qx3WEq3TF+QQU
> q+Em6WhiYHQufj6OGnZCFJJ4SKDNUNzBkwzuoXay6jxvUtv3m1tGJyKMK0rYN7vv
> 24e8axxNjKucDr5uFx1L
> =PW5G
> -----END PGP SIGNATURE-----
>
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 8 Jul 2011 11:38:57 +0100
> From: Everton Blair <everton at connectedinternet.co.uk>
> To: varnish-misc at varnish-cache.org
> Subject: Fwd: [Wordpress]homepage not purging
> Message-ID:
>        <CAOAN0RTbMwwiYOTiZZcHA+h7HXYkDut7NLE_+c_ef=CCDxm4Xw at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi
>
> I've just started using Varnish with Wordpress/W3TC, and all is ok, apart
> from my homepage not purging when an update is made e.g. a new post.  I
> think this might be because my homepage is using a static page
> www.windows7news.com/magazine-homepage/ as it's homepage and is doing some
> magic within Wordpress to show this page when the page
> www.windows7news.com/is requested i.e. the server doesn't know that
> www.windows7news.com/magazine-homepage/ needs purging.
>
> I thought I'd temporariliy managed to fix this by adding:
>
> sub vcl_recv {
>       if (req.url ~ "^/") {
>               return(pass);
>            }
> }
>
> But I only managed to turn the cache off completely.  Is there anyway to
> tell Varnish to always purge the homepage if there's a change?
>
> Thanks in advance for any help.
>
> My full VCL is below.  If anyone has any Wordpress specific changes they'd
> like to share then please send them my way!
>
>  Regards
>
> EB
>
>
> -----------------------------------------------------------------------------------------------------------------------------------
>
> backend b96_30_20_4 {
> .host = "96.30.20.4";
> .port = "8080";
> .probe = {
>                .url = "/";
>                .interval = 5s;
>                .timeout = 1 s;
>                .window = 5;
>                .threshold = 3;
>  }
> // we include time outs so uploads don't time out
>  .connect_timeout = 600s;
>  .first_byte_timeout = 600s;
>  .between_bytes_timeout = 600s;
> }
>
> backend b96_30_20_5 {
> .host = "96.30.20.5";
> .port = "8080";
> .probe = {
>                .url = "/";
>                .interval = 5s;
>                .timeout = 1 s;
>                .window = 5;
>                .threshold = 3;
>  }
> // we include time outs so uploads don't time out
>  .connect_timeout = 600s;
>  .first_byte_timeout = 600s;
>  .between_bytes_timeout = 600s;
> }
>
> backend b96_30_20_6 {
> .host = "96.30.20.6";
> .port = "8080";
> .probe = {
>                .url = "/";
>                .interval = 5s;
>                .timeout = 1 s;
>                .window = 5;
>                .threshold = 3;
>  }
> // we include time outs so uploads don't time out
>  .connect_timeout = 600s;
>  .first_byte_timeout = 600s;
>  .between_bytes_timeout = 600s;
> }
>
> backend b96_30_20_7 {
> .host = "96.30.20.7";
> .port = "8080";
> .probe = {
>                .url = "/";
>                .interval = 5s;
>                .timeout = 1 s;
>                .window = 5;
>                .threshold = 3;
>  }
> // we include time outs so uploads don't time out
>  .connect_timeout = 600s;
>  .first_byte_timeout = 600s;
>  .between_bytes_timeout = 600s;
> }
>
> backend b96_30_18_15 {
> .host = "96.30.18.15";
> .port = "8080";
>  .probe = {
>                .url = "/";
>                .interval = 5s;
>                .timeout = 1 s;
>                .window = 5;
>                .threshold = 3;
>  }
> // we include time outs so uploads don't time out
>  .connect_timeout = 600s;
>  .first_byte_timeout = 600s;
>  .between_bytes_timeout = 600s;
> }
>
> acl a96_30_20_4 {
> "96.30.20.4";
> }
> acl a96_30_20_5 {
> "96.30.20.5";
> }
> acl a96_30_20_6 {
> "96.30.20.6";
> }
> acl a96_30_20_7 {
> "96.30.20.7";
> }
> acl a96_30_18_15 {
> "96.30.18.15";
> }
>
> acl purge {
>        "96.30.20.4";
>  "96.30.20.5";
> "96.30.20.6";
> "96.30.20.7";
>  "96.30.18.15";
> }
>
> sub vcl_recv {
> if (server.ip ~ a96_30_20_4) {
>  set req.backend = b96_30_20_4;
> }
> if (server.ip ~ a96_30_20_5) {
>  set req.backend = b96_30_20_5;
> }
> if (server.ip ~ a96_30_20_6) {
>  set req.backend = b96_30_20_6;
> }
> if (server.ip ~ a96_30_20_7) {
>  set req.backend = b96_30_20_7;
> }
> if (server.ip ~ a96_30_18_15) {
>  set req.backend = b96_30_18_15;
> }
> }
>
> sub vcl_recv {
>        if (req.request == "PURGE") {
>                if (!client.ip ~ purge) {
>                        error 405 "Not allowed.";
>                }
>                return(lookup);
>        }
> if (req.url ~ "^/") {
>               return(pass);
>            }
> if (req.url ~ "^/forum/$") {
>               return(pass);
>            }
> if (req.url ~ "^/$") {
>               unset req.http.cookie;
>            }
> }
> sub vcl_hit {
>        if (req.request == "PURGE") {
>                set obj.ttl = 0s;
>                error 200 "Purged.";
>        }
> }
> sub vcl_miss {
>        if (req.request == "PURGE") {
>                error 404 "Not in cache.";
>        }
> if (!(req.url ~ "wp-(login|admin)")) {
>                 unset req.http.cookie;
>                }
>    if (req.url ~
>
> "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$")
> {
>       unset req.http.cookie;
>       set req.url = regsub(req.url, "\?.$", "");
>    }
>    if (req.url ~ "^/$") {
>       unset req.http.cookie;
>    }
> }
> sub vcl_fetch {
>        if (req.url ~ "^/$") {
>                unset beresp.http.set-cookie;
>        }
> if (!(req.url ~ "wp-(login|admin)")) {
>                        unset beresp.http.set-cookie;
> }
> }
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/bf4bd761/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Fri, 08 Jul 2011 12:41:30 +0200
> From: Tollef Fog Heen <tfheen at varnish-software.com>
> To: google at alexus.org
> Cc: varnish-misc at varnish-cache.org
> Subject: Re: errno = Connection reset by peer
> Message-ID: <8739iht5ph.fsf at qurzaw.varnish-software.com>
> Content-Type: text/plain; charset=us-ascii
>
> ]] alexus
>
> |    70 Debug        c "Write error, retval = -1, len = 10212, errno =
> | Connection reset by peer"
> |
> | other then vcl_error(404, unknown virtual host) what that other message
> | really mean?
>
> That the client disconnected before we were done sending the object.
>
> --
> Tollef Fog Heen
> Varnish Software
> t: +47 21 98 92 64
>
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 08 Jul 2011 12:44:45 +0200
> From: Tollef Fog Heen <tfheen at varnish-software.com>
> To: Jonathan Hursey <jonathan.hursey at adrevolution.com>
> Cc: varnish-misc at varnish-cache.org
> Subject: Re: Varnishstat question
> Message-ID: <87y609rqzm.fsf at qurzaw.varnish-software.com>
> Content-Type: text/plain; charset=us-ascii
>
> ]] Jonathan Hursey
>
> Hi,
>
> | Greetings fellow varnish enthusiasts. I was wondering if anyone could
> help
> | me determine what would be considered good values for the follow fields
> in
> | varnishstat output and what these fields indicate:
> |
> |   1         0.00         0.00 N vcl total
> |            1         0.00         0.00 N vcl available
>
> This just tells you that you have one VCL loaded.
>
> |            7          .            .   N total active purges
> |            7         0.00         0.00 N new purges added
>
> You have 7 bans added
>
> |         6112         0.00         0.02 N objects tested
>
> And 6112 objects tested against those bans in total.
>
> Regards,
> --
> Tollef Fog Heen
> Varnish Software
> t: +47 21 98 92 64
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 30 Jun 2011 20:44:26 -0400
> From: Lee Trout <lee at leetrout.com>
> To: varnish-misc at varnish-cache.org
> Subject: Possible bug with very large headers in varnish-3.0.0
>        revision 3bd5997
> Message-ID: <BANLkTin7OC0zAFdedQQk3Mb42ozP=eVPwg at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello!
>
> Please excuse the interruption, but I wanted to see if I may have
> stumbled upon a bug or if there is a known issue or configuration
> option for requests with very large header values.
>
> Using varnish-3.0.0 revision 3bd5997 when a large request comes in
> (cookie header ~3k characters) the header is lost.  I am seeing
> "LostHeader   c Cookie:" in the logs.
>
> This paste includes the request and results comparing varnish-3.0.0
> revision 3bd5997 and varnish-2.1.4 SVN 5447M
> http://pastebin.com/J2Qn0KGn
>
> Thank you in advance for your time and suggestions.
>
> Lee
> --
> Lee Trout
> http://www.leetrout.com
>
>
>
> ------------------------------
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> End of varnish-misc Digest, Vol 64, Issue 13
> ********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110708/c40bf9ed/attachment-0003.html>


More information about the varnish-misc mailing list