Skip to content

fix(@angular/ssr): support all X-Forwarded-* headers when trustProxyHeaders is true#33170

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:proxy-headers
Open

fix(@angular/ssr): support all X-Forwarded-* headers when trustProxyHeaders is true#33170
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:proxy-headers

Conversation

@alan-agius4
Copy link
Copy Markdown
Collaborator

Previously, setting trustProxyHeaders: true only allowed a predefined set of common proxy headers (such as x-forwarded-for and x-forwarded-host). This resulted in warning logs when requests contained other valid proxy headers like x-forwarded-client-cert or x-forwarded-email.

Closes #33169

@alan-agius4 alan-agius4 force-pushed the proxy-headers branch 2 times, most recently from 5d7dfa1 to dd9e29e Compare May 12, 2026 13:19
@alan-agius4 alan-agius4 requested a review from dgp1130 May 12, 2026 13: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 May 12, 2026
Copy link
Copy Markdown

@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 refactors the proxy header validation logic in the Angular SSR package. It replaces the fixed list of X-Forwarded-* headers with a wildcard sentinel string (ɵ*) when trustProxyHeaders is enabled, effectively allowing all proxy headers to be trusted. The corresponding tests were updated to use the normalizeTrustProxyHeaders utility and verify that additional headers are now correctly handled. I have no feedback to provide.

@alan-agius4 alan-agius4 added target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels May 12, 2026
…eaders is true

Previously, setting `trustProxyHeaders: true` only allowed a predefined set of common proxy headers (such as `x-forwarded-for` and `x-forwarded-host`). This resulted in warning logs when requests contained other valid proxy headers like `x-forwarded-client-cert` or `x-forwarded-email`.

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

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/ssr target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trustProxyHeaders: true does not seems to work as expected

1 participant