Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,11 @@ async def lifespan(app: FastAPI):
no_docs = os.getenv("ENVIRONMENT") == "production"

dev_origins = [
"http://localhost:3000", # If we don't specify port, it defaults to 80
"http://127.0.0.1:3000",
"http://localhost:3001", # Sometimes VSCode thinks 3000 is used, so the frontend uses a higher port
"http://127.0.0.1:3001", # Wildcard ports don't work with cookies so we need this cursed mess :(
"http://localhost:3002",
"http://127.0.0.1:3002",
"http://localhost:3003",
"http://127.0.0.1:3003",
"http://localhost", # Idk if this is even needed
]

stage_origins = [
"https://stage.frontend.fsektionen.se",
"http://localhost:3000", # If we don't specify port, it defaults to 80
"http://127.0.0.1:3000",
"http://localhost:3001", # Sometimes VSCode thinks 3000 is used, so the frontend uses a higher port
"http://127.0.0.1:3001",
"http://localhost:3002",
"http://127.0.0.1:3002",
"http://localhost:3003",
"http://127.0.0.1:3003",
]

production_origins = ["https://fsektionen.se"]
Expand All @@ -86,6 +71,7 @@ async def lifespan(app: FastAPI):
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
allow_origin_regex="\bhttp://(localhost|127\.0\.0\.1):(\d+)\b", # Allow all localhost origins with any port
)

if os.getenv("ENVIRONMENT") == "stage":
Expand All @@ -95,6 +81,7 @@ async def lifespan(app: FastAPI):
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
allow_origin_regex="\bhttp://(localhost|127\.0\.0\.1):(\d+)\b", # Allow all localhost origins with any port
)

if os.getenv("ENVIRONMENT") == "production":
Expand Down
Loading