fix(router): stop dropping client-sent default headers like anthropic-version#320
Merged
johntmyers merged 1 commit intomainfrom Mar 15, 2026
Merged
Conversation
…-version The strip_headers list in send_backend_request included default_headers names (e.g. anthropic-version), which removed the client's value. The already_sent check then saw the original input still contained the header and skipped injecting the route default. Neither value reached upstream. Remove default_headers names from strip_headers so client values pass through. The existing already_sent guard still injects defaults only when the client omits them.
pimlock
approved these changes
Mar 15, 2026
drew
pushed a commit
that referenced
this pull request
Mar 16, 2026
…-version (#320) The strip_headers list in send_backend_request included default_headers names (e.g. anthropic-version), which removed the client's value. The already_sent check then saw the original input still contained the header and skipped injecting the route default. Neither value reached upstream. Remove default_headers names from strip_headers so client values pass through. The existing already_sent guard still injects defaults only when the client omits them.
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.
Summary
Fix a bug where client-sent headers that match route
default_headersnames (e.g.anthropic-version) are silently dropped, causing upstream API errors for third-party clients like OpenClaw.Related Issue
N/A — reported via direct debugging session.
Changes
default_headersnames from thestrip_headerslist insend_backend_request(backend.rs). Only auth headers (authorization,x-api-key) andhostare stripped now.proxy_forwards_client_anthropic_version_headerthat verifies a client-sentanthropic-versionheader reaches the upstream.Root Cause
send_backend_requestaddeddefault_headersnames tostrip_headers, which removed the client's value in the forwarding loop. The subsequentalready_sentcheck looked at the original input headers, saw the client had sent it, and skipped injecting the route default. Neither the client's value nor the default reached the upstream.After the fix:
already_sent = true, default skipped. Client value wins.already_sent = false, default injected. Route default wins.Auth headers are still unconditionally stripped and re-injected via the route's auth mechanism — no security regression.
Testing
mise run pre-commitpassesChecklist