Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] UseCache-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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Cache-Control: must-revalidate only if explicit lifetime has been givenderrabus commentedNov 18, 2019
|
mpdude commentedNov 18, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
TIL that if the status code iscacheable 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. |
nicolas-grekas commentedNov 18, 2019
Should the PR target 3.4? |
nicolas-grekas commentedNov 28, 2019
I don't understand the change. When there is an ETag, we should send |
mpdude commentedNov 28, 2019
As an Nit-picking, really. |
mpdude commentedNov 28, 2019
I agree the RFC might have chosen more intention-revealing names. |
nicolas-grekas commentedNov 28, 2019
An ETag without a lifetime is considered as having a zero lifetime by browsers AFAIK. |
mpdude commentedNov 28, 2019
No, it would not. If the lifetime is considered to be zero,
|
nicolas-grekas commentedNov 28, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Oh, so no-cache <=> must-revalidate,maxage=0 got it. Works then. |
fabpot commentedNov 30, 2019
Tests do not pass apparently. |
mpdude commentedDec 2, 2019
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 ;-) |
mpdude commentedDec 2, 2019
Maybe@nicolas-grekas can confirm that the |
…t lifetime has been given
bf88c19 to1b1002bComparenicolas-grekas commentedDec 10, 2019
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-Controlisprivate, no-cachewhich means the response must not be served from cache unless it has been validated.If
Last-ModifiedorExpiresare present, we can relaxno-cacheto bemust-revalidate, which means thatonce the response has become stale, it must be revalidated.An
ETagalone does not give the response a lifetime, so IMO sticking withno-cachein this case would be more consistent.