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.
Problem/Motivation
Currently the expire integration doesn't seem to support language prefixes.
Proposed resolution
Add a language prefix pattern if one if the language negotiation based on url prefixes is enabled.
The attached patch should also "enhance" the pattern from something like this:
^/node/113$|^/de-node$|^/fr-node$|^/it-node$
to
^/(|de/|fr/|it/|en/)(node/113|de-node|fr-node|it-node)$
In test runs the pattern seemed to be slightly more efficient.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#8 | varnish-support-language-prefixes-2546218-8.patch | 1.97 KB | candelas |
Comments
Comment #2
natew CreditAttribution: natew commentedI had the same problem and the proposed changes worked for me. I needed to re-roll the patch to apply to 7.x-1.0-beta3.
Comment #3
das-peter CreditAttribution: das-peter at Cando commentedAfter finding this issue #1481136: Avoid "Connection reset by peer" on large purge list by batching paths I decided to make a re-roll of this and include the change made there.
@natew May I ask you to suffix patches, not created against the latest dev, with "[patch-name]-do-not-test.patch"? Patches should generally be created against latest dev - one reason for this is to make sure the testbot can run, for more details see: https://www.drupal.org/patch/submit If you mark them with "do-not-test" the testbot isn't triggered and the ticket status isn't set accidentally to "needs work".
Comment #4
natew CreditAttribution: natew commentedThanks das-peter, I wasn't aware of this and will do so in the future. I apologize about any inconvenience this may have caused.
Comment #5
candelas CreditAttribution: candelas as a volunteer commentedThanks. The #3 patch works.
Comment #6
candelas CreditAttribution: candelas as a volunteer commentedI have this patch working for 3 months, so I consider that it is tested.
Comment #7
candelas CreditAttribution: candelas as a volunteer commentedComment #8
candelas CreditAttribution: candelas as a volunteer commentedI actualize to varnish 7.x-1.1 I had to remove this because it was already applied.
Here the new patch from #3 that works with 7.x-1.1 and last dev. I put to needs review, since I have not tested it enough.
Comment #9
candelas CreditAttribution: candelas as a volunteer commentedComment #10
Max86 CreditAttribution: Max86 commentedHi thx for patch.
#8 worked for me for nodes with multilanguage support.
But I run in problem that front page doesn't clear on node save, may be it is issue of expire module?
Comment #11
candelas CreditAttribution: candelas as a volunteer commented@Max86 I am not having problems, but you can make a rule and I also use the https://www.drupal.org/project/ui_cache_clear because sometimes I make in dev things that I pass to production and I need to clear cache for a page.
Comment #12
dshields CreditAttribution: dshields at Canadian Blood Services commented#8 works perfectly for me! RTBC
Comment #13
rv0 CreditAttribution: rv0 at Coworks.be commented#8 works fine for me
just one tiny detail, I believe it does not work for the frontpage with this approach because it makes the '' path into a 'prefix/' path, while for flushing the front page requires '/prefix'
For now I quickfixed it for my case using
hook_expire_cache_alter()
of course this is a very specific fix for my usecase :)
Comment #14
Marko B CreditAttribution: Marko B commentedThis certanly can be fixed here, but isn't it a wrong place to fix? Expire module is sending the list of urls that need to be purged and it is doing it wrong. There are issues posted about that there
https://www.drupal.org/node/2291643
https://www.drupal.org/node/2267305
https://www.drupal.org/node/2291643
So if its solved there, this patch is not really needed and not a nice way to fix this problem.
Comment #15
das-peter CreditAttribution: das-peter at Cando commentedSomewhat related to the comment of Marko B:
There's now also Drupal 8 Cache Backport and Render Cache both supporting setting the
X-Drupal-Cache-Tags
HTTP header.Below an example how you can utilize this to handle the varnish cache:
I hadn't time jet to make a nice integration into this module but think that would be a neat addition as it is way more efficient.
Comment #16
MiSc CreditAttribution: MiSc at Wunder commentedClosing this, should be solved in expire module.