Skip to content

fix(@angular/ssr): use only the first value of the `X-Forwarded-Prefi… - #34378

Open
SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/ssr-x-forwarded-prefix-first-value
Open

SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/ssr-x-forwarded-prefix-first-value

Conversation

@SkyZeroZx

Copy link
Copy Markdown
Contributor

The X-Forwarded-Prefix header is validated using its first comma-separated value, like the other X-Forwarded-* headers. However, redirects used the entire header value. With a trusted header, any value after the first one was added to the Location header without being validated.

The first value is now used wherever the header is read, which matches how X-Forwarded-Host, X-Forwarded-Proto and X-Forwarded-Port are handled.

…x` header

The `X-Forwarded-Prefix` header is validated using its first
comma-separated value, like the other `X-Forwarded-*` headers. However,
redirects used the entire header value. With a trusted header, any
value after the first one was added to the `Location` header without
being validated.

The first value is now used wherever the header is read, which matches
how `X-Forwarded-Host`, `X-Forwarded-Proto` and `X-Forwarded-Port` are
handled.

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

Copy link
Copy Markdown

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 updates the Angular SSR package to only use the first value of the 'X-Forwarded-Prefix' header when constructing redirect locations and base hrefs, preventing issues when multiple prefixes are supplied. Unit tests have been added to verify this behavior. There are no review comments, and I have no additional feedback to provide.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant