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: strip SERVER_ROOT_PATH prefix before checking mapped pass-through routes

joereynae491cace8102
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index a06a3aa3daf..1033ba7921a 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -2058,8 +2058,13 @@ class InitPassThroughEndpointHelpers:
bool: True if route is a registered pass-through endpoint, False otherwise
"""
## CHECK IF MAPPED PASS THROUGH ENDPOINT
+ # Strip server root path prefix so mapped routes match when SERVER_ROOT_PATH is set
+ root_path = get_server_root_path()
+ normalized_route = route
+ if root_path and root_path != "/" and route.startswith(root_path):
+ normalized_route = route[len(root_path):]
for mapped_route in LiteLLMRoutes.mapped_pass_through_routes.value:
- if route.startswith(mapped_route):
+ if normalized_route.startswith(mapped_route):
return True
# Fast path: check if any registered route key contains this path