fix: strip SERVER_ROOT_PATH prefix before checking mapped pass-through routes

This commit is contained in:
joereyna 2026-03-11 19:14:35 -07:00
parent 50e68dc387
commit e491cace81

View file

@ -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