diff --git a/backend/app/main.py b/backend/app/main.py index bd8b6117..47f10349 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -20,6 +20,7 @@ async def lifespan(app: FastAPI): # Startup logger.info("Starting Patherly API server...") 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 # await init_db() yield @@ -87,3 +88,13 @@ async def root(): async def health_check(): """Health check endpoint.""" 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)" + }