diff --git a/vllm/entrypoints/openai/api_server.py b/vllm/entrypoints/openai/api_server.py index e550943c88725..32282bfd8d12b 100644 --- a/vllm/entrypoints/openai/api_server.py +++ b/vllm/entrypoints/openai/api_server.py @@ -127,7 +127,8 @@ async def create_completion(request: CompletionRequest, raw_request: Request): @app.middleware("http") async def authentication(request: Request, call_next): - if not request.url.path.startswith("/v1"): + root_path = "" if args.root_path is None else args.root_path + if not request.url.path.startswith(f"{root_path}/v1"): return await call_next(request) if request.headers.get("Authorization") != "Bearer " + token: return JSONResponse(content={"error": "Unauthorized"},