Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: restrict x-pass- header forwarding for protected header names

Yuneng Jiangf46e9959db59
diff --git a/litellm/passthrough/utils.py b/litellm/passthrough/utils.py
index ef4357d1ca2..8ae32d37a93 100644
--- a/litellm/passthrough/utils.py
+++ b/litellm/passthrough/utils.py
@@ -56,11 +56,15 @@ class BasePassthroughUtils:
# Combine request headers with custom headers
headers = {**request_headers, **headers}
- # Always process x-pass- prefixed headers (strip prefix and forward)
+ # Process x-pass- prefixed headers (strip prefix and forward)
+ # Certain protocol-level and credential headers are excluded from this mechanism.
+ _PROTECTED_HEADERS = {"authorization", "api-key", "host", "content-length"}
for header_name, header_value in request_headers.items():
if header_name.lower().startswith(PASS_THROUGH_HEADER_PREFIX):
# Strip the 'x-pass-' prefix to get the actual header name
actual_header_name = header_name[len(PASS_THROUGH_HEADER_PREFIX) :]
+ if actual_header_name.lower() in _PROTECTED_HEADERS:
+ continue
headers[actual_header_name] = header_value
return headers