skip transfer cache for credentialed requests and uncacheable request/responses#69017
Closed
SkyZeroZx wants to merge 3 commits into
Closed
skip transfer cache for credentialed requests and uncacheable request/responses#69017SkyZeroZx wants to merge 3 commits into
SkyZeroZx wants to merge 3 commits into
Conversation
Treat HttpClient requests using `credentials: 'include'` and `same-origin` as credentialed when deciding whether a response can be stored in the HTTP transfer cache. The transfer cache already skips requests with `withCredentials`, `Cookie`, `Authorization`, or `Proxy-Authorization` because those responses may contain user-specific data. Fetch-backed requests can express the same credentialed behavior through the `credentials` option, so these responses must not be serialized into the SSR HTML. This keeps credentialed SSR responses out of TransferState and aligns the cache eligibility check with the fetch request options supported by HttpClient.
2bb2168 to
8ec0197
Compare
b2beb84 to
8d04a64
Compare
8d04a64 to
3f562bd
Compare
Do not store HTTP transfer cache entries when either the request or response uses `Cache-Control: no-store`, `Cache-Control: private`, or `Cache-Control: no-cache`. Also skip transfer cache when requests use the Fetch API `cache` option with `no-store` or `no-cache`. Because transfer cache serializes SSR HTTP responses into the rendered HTML, Angular now treats these directives conservatively to avoid exposing sensitive or explicitly uncacheable data through `TransferState`.
3f562bd to
4d15015
Compare
alan-agius4
approved these changes
Jun 1, 2026
| } | ||
|
|
||
| return cacheControl.split(',').some((directive) => { | ||
| const directiveName = directive.trim().split('=', 1)[0].trim().toLowerCase(); |
Contributor
There was a problem hiding this comment.
The first trim is redundant.
Suggested change
| const directiveName = directive.trim().split('=', 1)[0].trim().toLowerCase(); | |
| const directiveName = directive..split('=', 1)[0].trim().toLowerCase(); |
alan-agius4
approved these changes
Jun 1, 2026
Contributor
Author
|
@JeanMeche I think the PR would be ready to merge? That way I could also generate the corresponding backports. |
JeanMeche
approved these changes
Jun 2, 2026
This was referenced Jun 2, 2026
Contributor
|
This PR was merged into the repository. The changes were merged into the following branches:
|
atscott
pushed a commit
that referenced
this pull request
Jun 3, 2026
Do not store HTTP transfer cache entries when either the request or response uses `Cache-Control: no-store`, `Cache-Control: private`, or `Cache-Control: no-cache`. Also skip transfer cache when requests use the Fetch API `cache` option with `no-store` or `no-cache`. Because transfer cache serializes SSR HTTP responses into the rendered HTML, Angular now treats these directives conservatively to avoid exposing sensitive or explicitly uncacheable data through `TransferState`. PR Close #69017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(http): skip transfer cache for fetch credentialed requests
Treat HttpClient requests using
credentials: 'include'andsame-originas credentialed when deciding whether a response can be stored in the HTTP transfer cache.The transfer cache already skips requests with
withCredentials,Cookie,Authorization, orProxy-Authorizationbecause those responses may contain user-specific data. Fetch-backed requests can express the same credentialed behavior through thecredentialsoption, so these responses must not be serialized into the SSR HTML.This keeps credentialed SSR responses out of TransferState and aligns the cache eligibility check with the fetch request options supported by HttpClient.
This can be considered a variant of #67964
fix(http): skip transfer cache for uncacheable HTTP traffic
Do not store HTTP transfer cache entries when either the request or response
uses
Cache-Control: no-store,Cache-Control: private, orCache-Control: no-cache.Also skip transfer cache when requests use the Fetch API
cacheoption withno-storeorno-cache.Because transfer cache serializes SSR HTTP responses into the rendered HTML,
Angular now treats these directives conservatively to avoid exposing sensitive
or explicitly uncacheable data through
TransferState.