Add CORS debug logging and endpoint
This commit is contained in:
@@ -20,6 +20,7 @@ async def lifespan(app: FastAPI):
|
|||||||
# Startup
|
# Startup
|
||||||
logger.info("Starting Patherly API server...")
|
logger.info("Starting Patherly API server...")
|
||||||
logger.info(f"Environment: {'Development' if settings.DEBUG else 'Production'}")
|
logger.info(f"Environment: {'Development' if settings.DEBUG else 'Production'}")
|
||||||
|
logger.info(f"ALLOW_RAILWAY_ORIGINS: {settings.ALLOW_RAILWAY_ORIGINS}")
|
||||||
# Note: In production, use Alembic migrations instead of init_db
|
# Note: In production, use Alembic migrations instead of init_db
|
||||||
# await init_db()
|
# await init_db()
|
||||||
yield
|
yield
|
||||||
@@ -87,3 +88,13 @@ async def root():
|
|||||||
async def health_check():
|
async def health_check():
|
||||||
"""Health check endpoint."""
|
"""Health check endpoint."""
|
||||||
return {"status": "healthy"}
|
return {"status": "healthy"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/debug/cors")
|
||||||
|
async def debug_cors():
|
||||||
|
"""Debug endpoint to check CORS configuration."""
|
||||||
|
return {
|
||||||
|
"allow_railway_origins": settings.ALLOW_RAILWAY_ORIGINS,
|
||||||
|
"cors_mode": "regex" if settings.ALLOW_RAILWAY_ORIGINS else "list",
|
||||||
|
"allowed_origins": settings.allowed_origins if not settings.ALLOW_RAILWAY_ORIGINS else "*.up.railway.app (regex)"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user