Skip to content

fix(@angular/ssr): ensure unique values in redirect response Vary header#32780

Merged
dgp1130 merged 1 commit intoangular:mainfrom
alan-agius4:x-forward-prefix-unique
Mar 17, 2026
Merged

fix(@angular/ssr): ensure unique values in redirect response Vary header#32780
dgp1130 merged 1 commit intoangular:mainfrom
alan-agius4:x-forward-prefix-unique

Conversation

@alan-agius4
Copy link
Collaborator

Refactors the createRedirectResponse function to use a Set for constructing the Vary header. This ensures that X-Forwarded-Prefix is always present exactly once, and that existing Vary values from provided headers are correctly parsed, deduplicated, and preserved.

Updates the associated unit tests to reflect the new header order and verify the deduplication logic.

Refactors the `createRedirectResponse` function to use a `Set` for constructing the `Vary` header. This ensures that `X-Forwarded-Prefix` is always present exactly once, and that existing `Vary` values from provided headers are correctly parsed, deduplicated, and preserved.

Updates the associated unit tests to reflect the new header order and verify the deduplication logic.
@alan-agius4 alan-agius4 requested a review from dgp1130 March 17, 2026 10:20
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Mar 17, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses a potential issue with duplicate values in the Vary header for redirect responses by using a Set to ensure uniqueness. The logic is sound, and the accompanying unit tests effectively verify the fix, including the new deduplication behavior. I've provided one suggestion to make the implementation more concise using a more functional style, but the current approach is also perfectly valid.

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 17, 2026
@dgp1130 dgp1130 merged commit ff1160e into angular:main Mar 17, 2026
39 checks passed
@dgp1130
Copy link
Collaborator

dgp1130 commented Mar 17, 2026

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants