- Issue created by @Lukas von Blarer
- π¨πSwitzerland Lukas von Blarer
Looking at the
cache_page
table, the problem is obvious: all pages haveexpire
set to -1. - π¨πSwitzerland Lukas von Blarer
My cache metadata was not properly output by Twig.
After that page cache got disabled completely. How can I debug where in the render process max-age is set in a way that makes all pages uncachable?
- π©πͺGermany rgpublic DΓΌsseldorf π©πͺ πͺπΊ
I found debugging stuff like this extremely hard. I had some success going to "lib/Drupal/Core/Cache/CacheableMetadata.php" and e.g. doing a backtrace in merge() when an unwanted max-age:0 is about to get merged in.
Besides that, I still think this issue is very valid. This module currently only fixes the fact that a default Drupal installation doesnt properly bubble the Max-Age to the Cache-Control HTTP header. It doesnt do anything about the fact that the page cache doesnt support time-based expiration *at all*. Of course, I could write another module for this. But I think it might make sense to integrate it here, so we don't get to a point where we require a whole library of cache fixing modules to get a decent working caching mechanism in Drupal...
- π©πͺGermany rgpublic DΓΌsseldorf π©πͺ πͺπΊ
Ah. I see, I'm wrong. Page Cache seems to use $expire in core/modules/page_cache/src/StackMiddleware/PageCache.php, storeResponse. But I also found that only -1 ends up in the cache_page table. Weird.
- π«π·France prudloff Lille
Hello,
The issue here is that
PageCache::storeResponse()
uses theExpires
header but notCache-Control
to invalidate the page cache.
The attached patch helps workaround this problem. - π«π·France prudloff Lille
I just noticed that #2962699 contains a similar patch.
- last update
over 1 year ago 4 pass - π«π·France Grimreaper France π«π·
Hi,
Thanks for the reroll on 2.0.0-rc2. I use this patch now instead of #2962699-5: Expires header not set β for the version 8.x-1.x.
- π«π·France Grimreaper France π«π·
cache_control_override needs to take global max-age into account.
- Open on Drupal.org βCore: 10.1.x + Environment: PHP 8.1 & MariaDB 10.3.22last update
about 1 year ago Not currently mergeable. - Open on Drupal.org βCore: 10.1.x + Environment: PHP 8.1 & MariaDB 10.3.22last update
about 1 year ago Not currently mergeable. - Assigned to Grimreaper
- last update
about 1 year ago 4 pass - Issue was unassigned.
- last update
about 1 year ago 4 pass - π«π·France Grimreaper France π«π·
Here is the patch from MR for Composer usage.
- π«π·France prudloff Lille
We should probably decide which patch to keep between π Expires header not set Needs review and π¬ Page cache isn't invalidated Needs review .