From 9216b9cc38e8753de442877863ad651425902e1f Mon Sep 17 00:00:00 2001 From: Pierre Dulac Date: Thu, 16 May 2024 18:42:21 +0200 Subject: [PATCH] [Bugfix] Bypass authorization API token for preflight requests (#4862) --- vllm/entrypoints/openai/api_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vllm/entrypoints/openai/api_server.py b/vllm/entrypoints/openai/api_server.py index 7cd51b959a0ea..97b35262329ee 100644 --- a/vllm/entrypoints/openai/api_server.py +++ b/vllm/entrypoints/openai/api_server.py @@ -154,6 +154,8 @@ if __name__ == "__main__": @app.middleware("http") async def authentication(request: Request, call_next): root_path = "" if args.root_path is None else args.root_path + if request.method == "OPTIONS": + return await call_next(request) if not request.url.path.startswith(f"{root_path}/v1"): return await call_next(request) if request.headers.get("Authorization") != "Bearer " + token: