From e491cace81024cd361eaaeb7326e463978ff21b0 Mon Sep 17 00:00:00 2001 From: joereyna Date: Wed, 11 Mar 2026 19:14:35 -0700 Subject: [PATCH] fix: strip SERVER_ROOT_PATH prefix before checking mapped pass-through routes --- .../proxy/pass_through_endpoints/pass_through_endpoints.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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