Unverified Commit 0739b194 authored by A-Mahla's avatar A-Mahla Committed by GitHub
Browse files

[Frontend][Bugfix] allow using the default middleware with a root path (#3788)

Co-authored-by: A-Mahla <>
parent 77a6572a
...@@ -127,7 +127,8 @@ if __name__ == "__main__": ...@@ -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"},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment