-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Use Cache-Control: must-revalidate
only if explicit lifetime has been given
#34438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Cache-Control: must-revalidate
only if explicit lifetime has been given
|
TIL that if the status code is cacheable by default or a response without explicit freshness has been marked as explicitly cacheable (e.g., with a Until now, I always thought this was a browser quirk. |
Should the PR target 3.4? |
I don't understand the change. When there is an ETag, we should send |
As an Nit-picking, really. |
I agree the RFC might have chosen more intention-revealing names. |
An ETag without a lifetime is considered as having a zero lifetime by browsers AFAIK. |
No, it would not. If the lifetime is considered to be zero,
|
Oh, so no-cache <=> must-revalidate,maxage=0 got it. Works then. |
Tests do not pass apparently. |
Failing tests come from With the change from this PR, we now have If this change applies to an ESI subrequest, It thus adds an I need to think through the Second, I'll try to remove the TL;DR: Working on it ;-) |
Maybe @nicolas-grekas can confirm that the |
…t lifetime has been given
bf88c19
to
1b1002b
Compare
Thank you @mpdude. |
… if explicit lifetime has been given (mpdude) This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Use `Cache-Control: must-revalidate` only if explicit lifetime has been given | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | This is really nit-picking: The conservative, safe default for `Cache-Control` is `private, no-cache` which means the response must not be served from cache unless it has been validated. If `Last-Modified` or `Expires` are present, we can relax `no-cache` to be `must-revalidate`, which means that _once the response has become stale_, it must be revalidated. An `ETag` alone does not give the response a lifetime, so IMO sticking with `no-cache` in this case would be more consistent. Commits ------- 1b1002b [HttpFoundation] Use `Cache-Control: must-revalidate` only if explicit lifetime has been given
This is really nit-picking: The conservative, safe default for
Cache-Control
isprivate, no-cache
which means the response must not be served from cache unless it has been validated.If
Last-Modified
orExpires
are present, we can relaxno-cache
to bemust-revalidate
, which means that once the response has become stale, it must be revalidated.An
ETag
alone does not give the response a lifetime, so IMO sticking withno-cache
in this case would be more consistent.