www/nginx: make upstream client-address headers configurable - #5685
Open
EyJunge1 wants to merge 2 commits into
Open
www/nginx: make upstream client-address headers configurable#5685EyJunge1 wants to merge 2 commits into
EyJunge1 wants to merge 2 commits into
Conversation
Allow X-Forwarded-For, Forwarded, and provider client-IP headers to be sanitized at the upstream so nginx can act as a strict trust boundary.
Shorten upstream help text to match existing style and emit the Forwarded RFC 7239 maps only when an upstream uses Replace.
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.
Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:
If AI was used, please disclose:
Describe the problem
The
www/nginxplugin hardcodes upstream client-address headers inlocation.conf(X-Real-IP,X-Forwarded-Forvia$proxy_add_x_forwarded_for, etc.). There is no GUI option to change or disableX-Forwarded-For, no control over RFC 7239Forwarded, and provider headers such asCF-Connecting-IP/True-Client-IPare passed through unchanged.With trusted proxies and
real_ip_header,$remote_addris the validated client address, but$proxy_add_x_forwarded_forcan still preserve a client-supplied chain, and an unsanitizedForwardedheader can be preferred by backends overX-Real-IP. Existing include hooks cannot safely replace these location-levelproxy_set_headerdirectives without duplicates.Describe the proposed solution
Add Upstream advanced options next to the existing
x_forwarded_host_verbatimsetting:XFF: Mode— Append (default), Replace ($remote_addr), or DropForwarded: Mode— Preserve (default), Replace (sanitized RFC 7239 from$remote_addr+$scheme), or DropSuppress CF-/True-Client-IP— clear those headers before proxyingDefaults keep the current behavior. Generated config emits at most one
proxy_set_headerper header name. RFC 7239 maps are only generated when an upstream uses Forwarded Replace.Related issue
#5684