Skip to content

Commit

Permalink
[Frontend][Bugfix] allow using the default middleware with a root path (
Browse files Browse the repository at this point in the history
vllm-project#3788)

Co-authored-by: A-Mahla <>
  • Loading branch information
A-Mahla authored Apr 2, 2024
1 parent 77a6572 commit 0739b19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vllm/entrypoints/openai/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 0739b19

Please sign in to comment.