Skip to content

Commit

Permalink
main: change 'allow_origins' from * to URLs
Browse files Browse the repository at this point in the history
To send cross site requests from pulpito-ng with `withCredentials`,
the server cannot have `*` as allowed origins.

Signed-off-by: Vallari <[email protected]>
  • Loading branch information
VallariAg committed Aug 16, 2023
1 parent 52b682e commit 6d80019
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

DEPLOYMENT = os.getenv("DEPLOYMENT")
SESSION_SECRET_KEY = os.getenv("SESSION_SECRET_KEY")
PULPITO_URL = os.getenv("PULPITO_URL")
PADDLES_URL = os.getenv("PADDLES_URL")

log = logging.getLogger(__name__)
app = FastAPI()
Expand All @@ -26,7 +28,7 @@ def read_root(request: Request):
if DEPLOYMENT == "development":
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_origins=[PULPITO_URL, PADDLES_URL],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down

0 comments on commit 6d80019

Please sign in to comment.