feat: add configurable real_ip_header option for nginx#904
Open
vichaos wants to merge 4 commits intoapache:masterfrom
Open
feat: add configurable real_ip_header option for nginx#904vichaos wants to merge 4 commits intoapache:masterfrom
vichaos wants to merge 4 commits intoapache:masterfrom
Conversation
- Add apisix.nginx.realIpHeader configuration in values.yaml - Update configmap.yaml template to use configurable value - Default to X-Real-IP for backward compatibility This allows users to customize which header nginx uses to extract the real client IP address, supporting various load balancer and proxy configurations (e.g., X-Forwarded-For, CF-Connecting-IP).
|
Hi @vichaos, I think you missed to add a chart value for the complementary |
ngclinflows
reviewed
Nov 26, 2025
Author
|
@ngclinflows Thanks for raising this. I’ve added support for the complementary apisix.nginx_config.http.real_ip_from parameter in the chart values so APISIX can properly trust the defined IPs/CIDRs for client address handling. |
|
Seems good to me 👍 |
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.
Add configurable
real_ip_headeroption for nginx configurationSummary
This PR makes the nginx
real_ip_headerdirective configurable viavalues.yaml, allowing users to customize which header is used to extract the real client IP address.Changes
apisix.nginx.realIpHeaderconfiguration option invalues.yamlwith a default value of"X-Real-IP"configmap.yamltemplate to use the configurable value instead of hardcoded"X-Real-IP""X-Real-IP")Why This Change is Necessary
Different deployment environments and proxy setups use different headers to pass the original client IP address:
Load Balancer Variations: Different cloud providers and load balancers use different headers:
X-Forwarded-ForCF-Connecting-IPX-Forwarded-ForX-Real-IP(current default)Multi-Layer Proxy Environments: In complex deployments with multiple proxy layers (e.g., CDN → Load Balancer → Ingress → APISIX), the appropriate header may differ based on architecture.
Security and Rate Limiting: Correctly identifying client IPs is crucial for:
Flexibility: Without this configuration option, users would need to either:
This change provides the flexibility needed for various deployment scenarios while maintaining sensible defaults.
Usage Example
Or via Helm CLI: