Skip to content

fix(@angular/ssr): add support for configuring trusted proxy headers via environment variable#33056

Merged
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:env-proxy-headers
Apr 28, 2026
Merged

fix(@angular/ssr): add support for configuring trusted proxy headers via environment variable#33056
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:env-proxy-headers

Conversation

@alan-agius4
Copy link
Copy Markdown
Collaborator

@alan-agius4 alan-agius4 commented Apr 27, 2026

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.

@alan-agius4 alan-agius4 requested a review from dgp1130 April 27, 2026 06:44
@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Apr 27, 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 adds support for the NG_TRUSTED_PROXY_HEADERS environment variable and refactors environment variable parsing into a reusable helper function. A review comment recommends renaming a variable in the helper function to improve clarity given its now generic usage.

Comment thread packages/angular/ssr/node/src/environment-options.ts Outdated
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 27, 2026
@alan-agius4 alan-agius4 force-pushed the env-proxy-headers branch 4 times, most recently from 947597b to d7fb4a5 Compare April 27, 2026 12:14
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request Apr 27, 2026
…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.
Comment thread packages/angular/ssr/node/src/app-engine.ts
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request Apr 27, 2026
@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 Apr 27, 2026
@alan-agius4 alan-agius4 merged commit 126b19b into angular:main Apr 28, 2026
35 checks passed
@alan-agius4 alan-agius4 deleted the env-proxy-headers branch April 28, 2026 07:00
@alan-agius4
Copy link
Copy Markdown
Collaborator Author

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

amishne pushed a commit to angular/angular that referenced this pull request Apr 28, 2026
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.

3 participants