fix(@angular/ssr): add support for configuring trusted proxy headers via environment variable#33273
Open
dgp1130 wants to merge 1 commit into
Open
fix(@angular/ssr): add support for configuring trusted proxy headers via environment variable#33273dgp1130 wants to merge 1 commit into
dgp1130 wants to merge 1 commit into
Conversation
…via environment variable Adds support for configuring trusted proxy headers via the `NG_TRUST_PROXY_HEADERS` environment variable in `AngularNodeAppEngine`. This allows users to specify which proxy headers (such as `X-Forwarded-Host`) should be trusted when running the server-side application behind a reverse proxy, without needing to modify the application code. The environment variable accepts a comma-separated list of header names. If the `NG_TRUST_PROXY_HEADERS` environment variable is set and contains non-empty values, it will take precedence over the `trustProxyHeaders` option provided programmatically in the `AngularNodeAppEngine` constructor options. (cherry picked from commit 126b19b)
There was a problem hiding this comment.
Code Review
This pull request refactors environment options parsing and introduces support for the NG_TRUST_PROXY_HEADERS environment variable. However, the changes alter the behavior of allowedHosts by overriding programmatic options with environment variables instead of merging them, which could cause breaking changes. Additionally, NG_TRUST_PROXY_HEADERS should be updated to correctly parse boolean values ('true'/'false') instead of treating them as single-item string arrays.
alan-agius4
approved these changes
May 29, 2026
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.
This is a v19 port of #33056.
Adds support for configuring trusted proxy headers via the
NG_TRUST_PROXY_HEADERSenvironment variable inAngularNodeAppEngine. This allows users to specify which proxy headers (such asX-Forwarded-Host) should be trusted when running the server-side application behind a reverse proxy, without needing to modify the application code. The environment variable accepts a comma-separated list of header names. If theNG_TRUST_PROXY_HEADERSenvironment variable is set and contains non-empty values, it will take precedence over thetrustProxyHeadersoption provided programmatically in theAngularNodeAppEngineconstructor options.(cherry picked from commit 126b19b)