Spaces:
Sleeping
Sleeping
Merge pull request #13 from mwalker-tmd/feature/hf-deployment
Browse filesDiagnostic changes to identify CORS errors on production deployment.
- backend/main.py +9 -0
backend/main.py
CHANGED
|
@@ -48,6 +48,15 @@ app.add_middleware(
|
|
| 48 |
allow_headers=["*"],
|
| 49 |
)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
# Include the API endpoints
|
| 52 |
app.include_router(api_router, prefix="/api")
|
| 53 |
|
|
|
|
| 48 |
allow_headers=["*"],
|
| 49 |
)
|
| 50 |
|
| 51 |
+
logger.info(f"CORS ALLOWED_ORIGINS: {ALLOWED_ORIGINS}")
|
| 52 |
+
|
| 53 |
+
@app.middleware("http")
|
| 54 |
+
async def log_origin_and_path(request, call_next):
|
| 55 |
+
origin = request.headers.get("origin")
|
| 56 |
+
logger.debug(f"CORS DEBUG: Origin={origin}, Path={request.url.path}")
|
| 57 |
+
response = await call_next(request)
|
| 58 |
+
return response
|
| 59 |
+
|
| 60 |
# Include the API endpoints
|
| 61 |
app.include_router(api_router, prefix="/api")
|
| 62 |
|