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

Co-authored-by: A-Mahla <>
This commit is contained in:
A-Mahla 2024-04-02 10:20:28 +02:00 committed by GitHub
parent 77a6572aa5
commit 0739b1947f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,7 +127,8 @@ if __name__ == "__main__":
@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"},