From 19e544fbb96f2c4031cf0362b508075706c37108 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Wed, 21 Jan 2026 10:49:37 +0530 Subject: [PATCH] fix: UI 404 error when SERVER_ROOT_PATH is set --- litellm/proxy/proxy_server.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index f4e68c481a0..dae33ba4d71 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -542,7 +542,7 @@ def generate_feedback_box(): enterprise_proxy_config = None ################### -server_root_path = os.getenv("SERVER_ROOT_PATH", "") +server_root_path = get_server_root_path() _license_check = LicenseCheck() premium_user: bool = _license_check.is_premium() premium_user_data: Optional[ @@ -820,7 +820,6 @@ async def proxy_startup_event(app: FastAPI): # noqa: PLR0915 title=_title, description=_description, version=version, - root_path=server_root_path, # check if user passed root path, FastAPI defaults this value to "" lifespan=proxy_startup_event, # type: ignore[reportGeneralTypeIssues] ) @@ -896,7 +895,7 @@ def get_openapi_schema(): from litellm.proxy.common_utils.custom_openapi_spec import CustomOpenAPISpec openapi_schema = CustomOpenAPISpec.add_llm_api_request_schema_body(openapi_schema) - + # Fix Swagger UI execute path error when server_root_path is set if server_root_path: openapi_schema["servers"] = [{"url": "/" + server_root_path.strip("/")}] @@ -922,7 +921,7 @@ def custom_openapi(): from litellm.proxy.common_utils.custom_openapi_spec import CustomOpenAPISpec openapi_schema = CustomOpenAPISpec.add_llm_api_request_schema_body(openapi_schema) - + # Fix Swagger UI execute path error when server_root_path is set if server_root_path: openapi_schema["servers"] = [{"url": "/" + server_root_path.strip("/")}]