mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-07-19 02:37:10 +08:00
[Bugfix] Bypass authorization API token for preflight requests (#4862)
This commit is contained in:
parent
5e0391c040
commit
9216b9cc38
@ -154,6 +154,8 @@ if __name__ == "__main__":
|
|||||||
@app.middleware("http")
|
@app.middleware("http")
|
||||||
async def authentication(request: Request, call_next):
|
async def authentication(request: Request, call_next):
|
||||||
root_path = "" if args.root_path is None else args.root_path
|
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"):
|
if not request.url.path.startswith(f"{root_path}/v1"):
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
if request.headers.get("Authorization") != "Bearer " + token:
|
if request.headers.get("Authorization") != "Bearer " + token:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user