mwalker22 commited on
Commit
38a647d
·
unverified ·
2 Parent(s): b5ac515 dbc4c37

Merge pull request #13 from mwalker-tmd/feature/hf-deployment

Browse files

Diagnostic changes to identify CORS errors on production deployment.

Files changed (1) hide show
  1. 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