Skip to content

Add trust_forwarded_proto option for SSL redirect handling in r…#5260

Open
jerry-yuan wants to merge 6 commits intoNginxProxyManager:developfrom
jerry-yuan:develop
Open

Add trust_forwarded_proto option for SSL redirect handling in r…#5260
jerry-yuan wants to merge 6 commits intoNginxProxyManager:developfrom
jerry-yuan:develop

Conversation

@jerry-yuan
Copy link

@jerry-yuan jerry-yuan commented Jan 31, 2026

…everse proxy scenarios

As mentioned in #5216, when Nginx is behind another proxy server (like CloudFlare or AWS ALB), the force-SSL feature can cause redirect loops because Nginx sees the connection as plain HTTP while SSL is already handled upstream. This adds a new boolean option to trust the X-Forwarded-Proto header from upstream proxies.

Changes:

  • Add trust_forwarded_proto column to proxy_host table (migration)
  • Update model and API schema to support the new boolean field
  • Modify force-ssl Nginx template to check X-Forwarded-Proto/X-Forwarded-Scheme
  • Add map directives in nginx.conf to validate and sanitize forwarded headers
  • Add advanced option toggle in frontend UI with i18n support (EN/ZH)
  • Set proxy headers from validated map variables instead of $scheme

This allows administrators to control SSL redirect behavior when Nginx is deployed behind a TLS-terminating proxy.

…everse proxy scenarios

When Nginx is behind another proxy server (like CloudFlare or AWS ALB), the force-SSL
feature can cause redirect loops because Nginx sees the connection as plain HTTP
while SSL is already handled upstream. This adds a new boolean option to trust
the X-Forwarded-Proto header from upstream proxies.

Changes:
- Add `trust_forwarded_proto` column to proxy_host table (migration)
- Update model and API schema to support the new boolean field
- Modify force-ssl Nginx template to check X-Forwarded-Proto/X-Forwarded-Scheme
- Add map directives in nginx.conf to validate and sanitize forwarded headers
- Add advanced option toggle in frontend UI with i18n support (EN/ZH)
- Set proxy headers from validated map variables instead of $scheme

This allows administrators to control SSL redirect behavior when Nginx is deployed
behind a TLS-terminating proxy.
@jerry-yuan jerry-yuan changed the title Add trust_forwarded_proto option for SSL redirect handling in r… WIP: Add trust_forwarded_proto option for SSL redirect handling in r… Feb 1, 2026
@jerry-yuan jerry-yuan changed the title WIP: Add trust_forwarded_proto option for SSL redirect handling in r… Add trust_forwarded_proto option for SSL redirect handling in r… Feb 1, 2026
@jerry-yuan jerry-yuan marked this pull request as draft February 3, 2026 07:07
@jerry-yuan jerry-yuan closed this Feb 3, 2026
@jerry-yuan jerry-yuan reopened this Feb 3, 2026
@jerry-yuan jerry-yuan marked this pull request as ready for review February 3, 2026 07:09
@jerry-yuan
Copy link
Author

@jc21 May I ask you for a code review?

@nginxproxymanagerci
Copy link

Docker Image for build 6 is available on DockerHub:

nginxproxymanager/nginx-proxy-manager-dev:pr-5260

Note

Ensure you backup your NPM instance before testing this image! Especially if there are database changes.
This is a different docker image namespace than the official image.

Warning

Changes and additions to DNS Providers require verification by at least 2 members of the community!

@jc21 jc21 added the requires-verification Waiting for one or more people to confirm the fix label Feb 4, 2026
@jc21
Copy link
Member

jc21 commented Feb 4, 2026

Yep I'll see how I go today

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

Labels

requires-verification Waiting for one or more people to confirm the fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants