Fix/umami analytics header forwarding - #4205
Merged
Merged
Conversation
Behind a CDN/ingress/load balancer, nginx's $remote_addr is the proxy address, so the X-Real-IP header forwarded to Umami (which Umami prioritizes over X-Forwarded-For) identified the ingress as the visitor, breaking country/location analytics. Add opt-in real-IP resolution driven by deployment configuration: - TRUSTED_PROXY_CIDRS: comma- or space-separated list of trusted proxy CIDRs, emitted as set_real_ip_from directives (invalid entries are skipped with a warning) - REAL_IP_HEADER: header to recover the client IP from (default X-Forwarded-For), with real_ip_recursive on When set, $remote_addr resolves to the true client address and the existing X-Real-IP forwarding becomes correct. Unset, behavior is unchanged.
…es, log XFF - Apply set_real_ip_from/real_ip_header only inside the /x/ Umami proxy location, so $remote_addr for all other routes remains the direct peer and no client-supplied header is trusted outside analytics. - Default TRUSTED_PROXY_CIDRS to the private ranges reverse proxies normally connect from (10/8, 172.16/12, 192.168/16, fc00::/7) so the fix works out of the box behind in-cluster ingresses; internet clients cannot spoof these as source addresses. Set TRUSTED_PROXY_CIDRS=none to disable real IP resolution entirely. - Extend the access log format to append xff="$http_x_forwarded_for", recording the proxy-reported client chain verbatim alongside the direct peer address without trusting it.
kusssal
approved these changes
Aug 27, 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.
List of changes
Checklist