Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Fix that ESI/SSI processing can turn a "private" response "public"#26643
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
mpdude commentedMar 22, 2018
Ping@aschempp – you wrapped your head around the |
aschempp commentedMar 23, 2018
The fix looks somewhat correct to me, according to the PR title. However, the correct solution would be to make the final response private (and not non-cacheable). But I guess you're aware of that and this PR is to disable caching in favor of incorrect caching. |
mpdude commentedApr 11, 2018
@nicolas-grekas The appveyor test failed at Is that a known spurious test? |
fabpot commentedApr 16, 2018
Thank you@mpdude. |
…"public" (mpdude)This PR was squashed before being merged into the 2.7 branch (closes#26643).Discussion----------Fix that ESI/SSI processing can turn a "private" response "public"| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |Under the condition that* we are merging in at least one *embedded* response,* all *embedded* responses are `public`,* the *main* response is `private` and* all responses use expiration-based caching (note: no `s-maxage` on the *main* response)... the resulting response will turn to `Cache-Control: public`.The real issue is that when all responses use expiration-based caching, a combined max age is computed. This is set on the *main* response using `Response::setSharedMaxAge()`, which implicitly sets `Cache-Control: public`.The fix provided in this PR solves the problem by applying the same logic to the *main* response that is applied for *embedded* responses, namely that responses with `!Response::isCacheable()` will make the resulting response have `Cache-Control: private, no-cache, must-revalidate` and have `(s)max-age` removed.This makes the change easy to understand, but makes responses uncacheable too often. This is because the `Response::isCacheable()` method was written to determine whether it is safe for a shared cache to keep the response, which is not the case as soon as a `private` response is involved. This might be improved upon in another PR.Commits-------3d27b59 Fix that ESI/SSI processing can turn a \"private\" response \"public\"
Uh oh!
There was an error while loading.Please reload this page.
Under the condition that
public,privateands-maxageon themain response)... the resulting response will turn to
Cache-Control: public.The real issue is that when all responses use expiration-based caching, a combined max age is computed. This is set on themain response using
Response::setSharedMaxAge(), which implicitly setsCache-Control: public.The fix provided in this PR solves the problem by applying the same logic to themain response that is applied forembedded responses, namely that responses with
!Response::isCacheable()will make the resulting response haveCache-Control: private, no-cache, must-revalidateand have(s)max-ageremoved.This makes the change easy to understand, but makes responses uncacheable too often. This is because the
Response::isCacheable()method was written to determine whether it is safe for a shared cache to keep the response, which is not the case as soon as aprivateresponse is involved. This might be improved upon in another PR.