Active
Project:
Purge
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2011 at 11:50 UTC
Updated:
6 Apr 2016 at 05:42 UTC
Jump to comment: Most recent
After updating a site, it may be required to expire all pages. Should be done with care on sites with heavy traffic, but it would be great if we can do with a drush command or button in the admin.
I am using the following code for this (Varnish 3.x):
if (req.request == "PURGE" || req.request == "PURGEALL") {
if (!client.ip ~ purge) {
// Return error code 405 (Forbidden) when not
error 405 "Not allowed.";
}
if (req.request == "PURGE") {
// Purge all objects from cache that match the incoming url and host
ban("req.url == " + req.url + " && req.http.host == \"" + req.htt$
}
else {
// Purge all objects from cache that match the incoming host
ban("req.url ~ ^/ && req.http.host == " + req.http.host);
}
// Return a http error code 200 (Ok)
error 200 "Purged";
}
Comments
Comment #1
SqyD commentedHi maurits!
This feature request was expected and will be in a future release. Please see my comment on a similar feature request http://drupal.org/node/1299484#comment-5099470
Comment #2
SqyD commentedComment #3
sokrplare commentedThe VCL excerpt was helpful, so just for future folks who come across this, we used similar VCL logic and then implemented the call to PURGEALL in a custom module. That module already integrated with the Cache Expiration (expire) module to give us a backend form where we could expire specific URLs if needed, but this extended it to purge the whole domain. If you don't have the expire module you'd probably want to use different link paths.
Comment #4
Grayside commentedI put together a Purge All module based on this issue. It wires up a Purge All option that can be configured for use by nodes.