Hmm, okay, I switched to purge("req.url == " req.url) and it seems to be working, but I'm slightly confused as to why...

My two purges look like this:

mediawiki:
   15 RxRequest    c PURGE
   15 RxURL        c http://www.chrishecker.com/Homepage
   15 RxProtocol   c HTTP/1.0
   15 RxHeader     c Connection: Keep-Alive

wordpress + wp-varnish:
   15 RxRequest    c PURGE
   15 RxURL        c /2010/07/09/test-post/
   15 RxProtocol   c HTTP/1.0
   15 RxHeader     c Host: spyparty.com
   15 RxHeader     c Connection: Close

Am I correct in assuming req.url is the same as RxURL? If so, how are both the full http://blah url and the /blah url matching the url in the cache exactly (which is what == means, I assume). Or, is req.url expanded to the full url (meaning with the host added), not verbatim whatever comes in on the header?

My version of varnish (2.0.6) doesn't have the log statement, so I can't figure out how to put req.url into a header that will get printed to the log in the purge request so I can find out for myself. req is not available in vcl_deliver either, and purge bypasses everything else, etc.

Thanks,
Chris



On 2010/07/10 16:39, Chris Hecker wrote:

Ack, you're totally right. Brain was addled from 10 hours of server
nonsense! I will do the ==. Somebody should update the page.

Oh, wait, the reason I didn't do the == was because one backend sends a
full HTTP/1.0 style url in the PURGE, and the other sends a Host: and
just the relative path name. Hmm.

Chris


On 2010/07/10 07:22, Laurence Rowe wrote:
That example is only for handling wildcard purges. The one above uses
a direct comparison, which is what you want:

purge("req.url == " req.url);

Your regexp is not doing what you think it's doing either, purging "/"
will purge "/foo/" and "/foo/bar/" as well. You need to anchor it to
the beginning of the string too:

purge("req.url ~ ^" req.url "$");

This should allow wild card purges to work if you need them.

Laurence

On 10 July 2010 09:24, Chris Hecker<[email protected]> wrote:

Awesome, this worked great, thanks!

The one caveat that others might run into was that sometimes the backend
would sent / as the url, and I was using the regexp ~ version from
the link
you sent, so it would clear the whole cache. I changed it to this:

purge("req.url ~ " req.url "$"); # use regexp to handle all
Accept-Encoding's
error 200 "Purged in recv.";

and now it works perfectly.

Chris


On 2010/07/09 04:56, Laurence Rowe wrote:

On 9 July 2010 12:01, Chris Hecker<[email protected]> wrote:

I'm trying to put varnish in front of mediawiki, but there are a
couple
things going wrong with the purging support built into mediawiki
(which
supposedly supports varnish and squid).

1. Mediawiki was sending back an HTTP/1.0 PURGE command, which had no
Host:
header, just the full url after the PURGE, so the hash function wasn't
matching with the normal HTTP/1.1 requests. I patched mediawiki to fix
this
and send an HTTP/1.1 PURGE with a Host: header, not sure what a better
way
to do this would be.

2. The PURGE does not have an Accept-encoding: on it, so it doesn't
match
the cached object, which is almost always A-e: gzip. I hacked a gzip
header
onto the PURGE, but what I really want is to purge all the records
associated with an URL. Is there a way to do this?

See: http://varnish-cache.org/wiki/VCLExamplePurging

Using purge("req.url == " req.url); should fix both problems.

Laurence

_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc




_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc

Reply via email to