Problem/Motivation
See #606840-92: Enable internal page cache by default, plus comments #95, #96 and #97.
Caused by #2443073: Add #cache[max-age] to disable caching and bubble the max-age's adding of
// If an explicit non-infinite max-age is specified by a part of the page,
// respect that by applying it to the response's headers.
if ($cache_max_age !== Cache::PERMANENT) {
$response->setMaxAge($cache_max_age);
}
Which only was possible due to lacking test coverage.
Critical because:
That completely breaks reverse proxies? And If that's not a release-blocking bug, then I don't know what is? :)
(@Berdir in #606840-96: Enable internal page cache by default)
Proposed resolution
Revert that hunk and add test coverage. This is what @Berdir proposed in #606840-96: Enable internal page cache by default:
The max_age setting and the max-age bubbling seem to contradict each other, and we know that bubbling doesn't actually work yet, as long as many things are still setting max-age: 0. So I think we should disable that setMaxAge() until we know that it actually works as expected *and* is implemented in a way that doesn't break the other headers? Which we should probably be set unconditionally anyway? And then we can also remove the global max_age setting.
Remaining tasks
Do it.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#23 | maxage-bubbling-2467041-22.patch | 4.17 KB | mr.baileys |
#21 | maxage-bubbling-2467041-21.patch | 4.18 KB | mr.baileys |
#18 | maxage-bubbling-2467041-17-test-only.patch | 2.94 KB | mr.baileys |
#18 | maxage-bubbling-2467041-17.patch | 4.27 KB | mr.baileys |
#13 | interdiff-2467041-10-12.txt | 748 bytes | jan.stoeckler |
Comments
Comment #1
Wim LeersIS updated.
Comment #2
Wim LeersComment #3
BerdirThanks for creating the issue, I was too lazy again. +1 obviously, since it's my own suggestion :)
Comment #4
Fabianx CreditAttribution: Fabianx for Acquia commentedMy take on that is:
- Make the default -1 == CACHE::Permanent and expose it in the UI
- External proxy and internal cache override max-age with the configured value IF the user is anonymous, else max-age = 0
We should support max-age bubbling for page cache and external proxies at some other point though.
Comment #5
xjmComment #6
Wim LeersComment #7
jan.stoecklerI'll take a shot at this one.
Comment #8
xjmComment #9
mr.baileysHey @jan.tsoeckler, are you still working on this one?
Comment #10
jan.stoecklerSorry this took so long, I can't for the life of me figure out why the two added tests don't work as intended.
Comment #11
mr.baileysThe comment should also be reverted.
If I understand correctly, this issue is about the fact that when #cache max-age is set explicitly on any element, it bubbles up the stack up until it causes setMaxAge() to be called on the response (which is the change being reverted in this issue), and causes the the Cache-Control header to contain "max-age: 0, private" instead of the standard cache header (with max-age set to page.cache.max_age).
This test however seems to only test setting max_age on the page cache, not on elements itself, so I don't think correctly provides coverage for this issue.
In any case, could you upload the test separately? That way you can verify that the test fails, while your patch together with the test succeeds (if that is the case, it proves that your test correctly covers the bug.)
Comment #13
jan.stoecklerThanks for your review! I'm not quite sure whether or not bubbling is supposed to be supported at this point (I may well misconstrue the issue summary, though), so maybe this issue is just a bit too out of my wheelhouse. Anyway, uploaded the updated patch & the test separately.
Comment #14
jan.stoecklerForgot to change status, sorry (again).
Comment #17
jan.stoecklerI'm taking myself off this issue, there's no way I'm going to fix it in an appropriate time frame.
Comment #18
mr.baileysI talked to Wim Leers to determine how to best test this, patch attached.
Comment #19
Fabianx CreditAttribution: Fabianx for Acquia commentedRTBC, both patch and test look great to me.
We can always bring the code back when we properly support it.
Comment #20
alexpottSurely only the positive assertion is necessary? And we is the 300 coming from? The default configuration? We should get it from whether it is coming from.
Comment #21
mr.baileysComment #22
Fabianx CreditAttribution: Fabianx for Acquia commentedBack to RTBC, we indeed only need to check once.
Comment #23
mr.baileys... and fixed a typo in a comment.
Comment #24
mr.baileyscross-post.
Comment #26
znerol CreditAttribution: znerol commented+1. Is there any issue to make the max-age bubbling actually work?
Comment #27
alexpottThis issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 3bc5a5c and pushed to 8.0.x. Thanks!
I think the issue to fix this is #2352009: [pp-3] Bubbling of elements' max-age to the page's headers and the page cache
Comment #29
Wim Leers#26: as Alex Pott said: #2352009: [pp-3] Bubbling of elements' max-age to the page's headers and the page cache.