diff --git a/main.py b/main.py index a219289..3a3e997 100644 --- a/main.py +++ b/main.py @@ -37,9 +37,10 @@ app = FastAPI( app.add_middleware( CORSMiddleware, allow_origins=["*"], - allow_credentials=True, - allow_methods=["*"], + allow_credentials=False, # Must be False when using wildcard origins + allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"], allow_headers=["*"], + expose_headers=["*"], ) # Include routers @@ -62,6 +63,12 @@ async def health_check(): return {"status": "healthy", "service": "uptime-monitoring-api"} +@app.options("/{path:path}") +async def options_handler(): + """Handle preflight OPTIONS requests""" + return {"message": "OK"} + + if __name__ == "__main__": import uvicorn