[Frontend][Bugfix] allow using the default middleware with a root path (#3788)
Co-authored-by: A-Mahla <>
This commit is contained in:
parent
77a6572aa5
commit
0739b1947f
@ -127,7 +127,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
@app.middleware("http")
|
@app.middleware("http")
|
||||||
async def authentication(request: Request, call_next):
|
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)
|
return await call_next(request)
|
||||||
if request.headers.get("Authorization") != "Bearer " + token:
|
if request.headers.get("Authorization") != "Bearer " + token:
|
||||||
return JSONResponse(content={"error": "Unauthorized"},
|
return JSONResponse(content={"error": "Unauthorized"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user