Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The module only purges the current host, in the event that you're using multi-site directory aliasing the aliased pages are not purged.
Comment | File | Size | Author |
---|---|---|---|
#9 | purge-site-aliases-2185281-9.patch | 2.04 KB | rkostov |
#8 | purge-site-aliases-2185281-8.patch | 2.1 KB | MiroslavBanov |
#1 | purge-site-aliases-2185281-1.patch | 2.15 KB | thewilkybarkid |
Comments
Comment #1
thewilkybarkid CreditAttribution: thewilkybarkid commentedComment #2
bibo CreditAttribution: bibo commentedI'd like to add an alternative approach to this problem. I encountered the problem when using cdn-module to offer static files over different domain. In some cases I wanted the static files to be cleared in sync with the rest of the site.
I solved it by actually just ignoring the domain/alias-specific part of the Varnish purge, in a custom drush extension. If I recall correctly, and earlier version of the Varnish module didn't even care about the hostname-part, but flushed just based on the path, or internal url. It was added later to increase hitrates in some scenarios - such as when there are multiple different sites behind the same Varnish instance. It depends on the use case if that is necessary at all.
In my case I just used an internal function of varnish-module, to run this:
In essence it would be the same as running the purge through varnish_purge() where "req.http.host ~ $host &&" has been removed (+ the same for ban lurker version).
An option to choose if the purges are limited to the hostname of the active Drupal-installation could be added to the admin settings. Apart from settings form (and documentation of this option), this would only require a few lines in varnish_purge()-function to work globally.
EDIT: replaced some "\"-escaping with ', to avoid problems with drupal.org PHP-filter.
Comment #3
bibo CreditAttribution: bibo commentedI forgot to add that
$pattern = '/';
would work just as well as$pattern = '.*';
to flush everything, because "/" matches all paths (with the logic of Varnish).Comment #4
bibo CreditAttribution: bibo commentedThis issue or rather it's solution may be a partial duplicate of an earlier issue, with a slightly more cryptic title: #1847672: VarnishCache::clear() has different behaviour than DrupalDatabaseCache::clear()..
I'm not marking this as a duplicate just yet (if someone agrees though, please change the status). I'm linking to here in a comment from the other issue.
Comment #5
bibo CreditAttribution: bibo commentedComment #6
JeremyFrench CreditAttribution: JeremyFrench commentedTrying to clean these issues into one #2208329: Support Multi domain sites
Comment #7
JeremyFrench CreditAttribution: JeremyFrench commentedComment #8
MiroslavBanov CreditAttribution: MiroslavBanov commentedPatch #1 works for me, but adding a new patch that keeps the
_varnish_get_host()
function for backwards compatibility. Other modules may be using it, and it is still being called in some situation from varnish.cache.incComment #9
rkostov CreditAttribution: rkostov at FFW commentedpurge-site-aliases-2185281-9.patch is the same as #8 but compatible with the stable version 7.x-1.4