Skip to content

Commit 0739b19

Browse files
authored
[Frontend][Bugfix] allow using the default middleware with a root path (#3788)
Co-authored-by: A-Mahla <>
1 parent 77a6572 commit 0739b19

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vllm/entrypoints/openai/api_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ async def create_completion(request: CompletionRequest, raw_request: Request):
127127

128128
@app.middleware("http")
129129
async def authentication(request: Request, call_next):
130-
if not request.url.path.startswith("/v1"):
130+
root_path = "" if args.root_path is None else args.root_path
131+
if not request.url.path.startswith(f"{root_path}/v1"):
131132
return await call_next(request)
132133
if request.headers.get("Authorization") != "Bearer " + token:
133134
return JSONResponse(content={"error": "Unauthorized"},

0 commit comments

Comments
 (0)