skip auth for OPTIONS request
This commit is contained in:
parent
9aed6d1837
commit
2828737562
1 changed files with 4 additions and 0 deletions
|
|
@ -305,6 +305,10 @@ class HttpAPI(Common):
|
||||||
|
|
||||||
@web.middleware
|
@web.middleware
|
||||||
async def middleware_handler(request: Request, handler: RequestHandler) -> Response:
|
async def middleware_handler(request: Request, handler: RequestHandler) -> Response:
|
||||||
|
# if OPTIONS request, skip auth
|
||||||
|
if request.method == "OPTIONS":
|
||||||
|
return await handler(request)
|
||||||
|
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
if auth_header is None and request.query.get("apikey") is not None:
|
if auth_header is None and request.query.get("apikey") is not None:
|
||||||
auth_header = f"Basic {request.query.get('apikey')}"
|
auth_header = f"Basic {request.query.get('apikey')}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue