8000 Backend: Fixed CORS middleware configuration. by A1exKH · Pull Request #16 · A1exKH/ILQP · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /include-fragment>
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
9 changes: 5 additions & 4 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@

app = FastAPI(title="ILQP API", version="1.0.0")

# CORS Config for React frontend (Vite) can communicate with FastAPI
# Restrict CORS to your Vercel production frontend and local dev environments
origins = [
"http://localhost:5173",
"http://127.0.0.1:5173",
"https://ilqp.vercel.app",
"http://localhost:5173", # For local Vite development
"http://localhost:3000", # Alternative local port
]

app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # TODO (Production):Restrict this to frontend URL later
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
0