Conversation
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@config/config.yaml`:
- Around line 305-310: Update the comment for the trust_forwarded_headers config
key to mention that the server honors both the legacy X-Forwarded-For header and
the standard Forwarded header (RFC 7239), preferring the Forwarded header when
present; reference the config key name trust_forwarded_headers so readers know
which setting controls this behavior and keep the existing warning about
enabling it only behind a trusted proxy.
In `@src/settings.rs`:
- Around line 78-82: Update the docstring for the struct field
trust_forwarded_headers to mention that it controls handling of both the modern
Forwarded header and the legacy X-Forwarded-For header (not just
X-Forwarded-For), and keep the existing guidance about enabling it only behind
trusted proxies and the default false note so readers understand when to enable
it.
In `@src/tonic/logging.rs`:
- Around line 32-65: The extract_forwarded_ip function currently mishandles
Forwarded IPv6 values with ports (e.g. for="[2001:db8::1]:4711") because
trimming brackets leaves the trailing port; update the parsing in
extract_forwarded_ip (the Forwarded header handling block that looks for "for=")
to detect a leading '[' and, when present, use split_once(']') on the value
after removing an optional leading quote to extract only the IPv6 address
portion before any trailing ":port" (then remove the leading '[' and any
surrounding quotes), otherwise fallback to the existing trim_matches logic; keep
FORWARDED and X_FORWARDED_FOR handling intact and ensure the returned string is
the bare IP (no brackets, no port).
timvisee
requested changes
Feb 2, 2026
Member
timvisee
left a comment
There was a problem hiding this comment.
Temporarily adjusting review because of this IPv6 handling comment: #8028 (comment)
timvisee
approved these changes
Feb 3, 2026
Merged
generall
pushed a commit
that referenced
this pull request
Feb 9, 2026
* feat: add x-forwarded support * fix: port parsing & add tests * fix: case-insensitive mode
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.
Testing Forwarded Headers
This document describes how to test the
X-Forwarded-ForandForwardedheader support in Qdrant access logs.Configuration
Enable trusted forwarded headers in your config:
Or via environment variable:
export QDRANT__SERVICE__TRUST_FORWARDED_HEADERS=trueEnable gRPC Access Logs
gRPC access logs are disabled by default (trace level). Enable them with:
export QDRANT__LOG_LEVEL=info,qdrant::tonic::logging=traceTesting Without Load Balancer
Simulate proxy headers directly with curl/grpcurl.
HTTP (REST API)
gRPC
Expected Log Output
With
trust_forwarded_headers: true:With
trust_forwarded_headers: false(default):Testing With Nginx as Load Balancer
Nginx Configuration
Start Nginx
Stop Nginx
Test Through Nginx
Testing With Docker Compose
Security Verification
Verify that IP spoofing is blocked when
trust_forwarded_headers: false:Verify that headers are trusted when enabled:
Header Priority
Forwardedheader (RFC 7239) - checked firstX-Forwarded-Forheader - fallbackExample with both headers:
All Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: