Skip to content

Commit

Permalink
whitelist next.akatsuki.gg for cors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jul 7, 2024
1 parent f767d23 commit 33110a5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/init_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from fastapi import FastAPI
from fastapi import Request
from fastapi import Response
from fastapi.middleware.cors import CORSMiddleware
from starlette.middleware.base import RequestResponseEndpoint

from app import logger
Expand Down Expand Up @@ -53,6 +54,16 @@ async def http_middleware(
logging.exception("Exception in ASGI application")
return Response(status_code=500)

app.add_middleware(
CORSMiddleware,
allow_origins=["https://next.akatsuki.gg"],
allow_methods=["*"],
allow_headers=["*"],
allow_credentials=True,
# NOTE: this does not expose credentials/http cookies
expose_headers=["*"],
)

return app


Expand Down

0 comments on commit 33110a5

Please sign in to comment.