When running Cache Expiration and Varnish together, I noticed that my whole cache got cleared each time I published new content, despite choosing just to clear the node page and the front page on node inserts and updates.

From running ban.list in varnishadm I discovered the following ill-formed URLs in the ban list:

1398557987.981841     3G        req.http.host ~ www.mysite.com && req.url ~ /
1398563531.599103     0G        req.http.host ~ www.mysite.com && req.url ~ ^/<front>$|^/node/9042$|^/gold-market-trend$
1398560116.232775     0         req.http.host ~ www.mysite.com && req.url ~ ^/comment/2672$

The problem with the first line is that it is using ~ instead of ==. In Varnish syntax, ~ means regex. So the ~ / statement will clear all URLs containing a / from the cache. Since the leading / of every URL is counted, this will always clear EVERY URL in the cache bin.

The problem in the second line is obvious. is Drupal syntax for the front page, which Drupal will not understand. Should be replaced with ^/$ (deleted).

The third line is actually correct.

Documentation of the ban command can be seen at https://www.varnish-cache.org/docs/3.0/tutorial/purging.html

Comments

Mikael Nord’s picture

Issue summary: View changes
Spleshka’s picture

Mikael, try using latest release. There I changed behavior from using to using / symbol.

Now about using ~ instead of ==. I guess this is a Varnish issue, because Cache Expiration has nothing common with varnish requests.

Mikael Nord’s picture

Confirmed. The ~ problem is a (kind of) solved Varnish issue.

Edit: Cache Expiration now sends ^/$ to Varnish as expected. Good job -- issue is fixed.

Mikael Nord’s picture

Status: Active » Closed (fixed)