anderson-ufrj commited on
Commit
386e9aa
·
1 Parent(s): 39c13e4

fix: configure uvicorn proxy headers for HuggingFace deployment

Browse files

Configure uvicorn to properly handle proxy headers in HuggingFace Spaces
environment. This resolves "Invalid host header" errors caused by the
proxy infrastructure.

Changes:
- Add forwarded_allow_ips="*" to accept all proxy IPs
- Add proxy_headers=True to trust X-Forwarded-* headers
- Apply configuration to start_hf.py entry point used by HuggingFace

This ensures the backend correctly handles requests from the HuggingFace
Spaces proxy layer.

Files changed (1) hide show
  1. start_hf.py +3 -1
start_hf.py CHANGED
@@ -34,5 +34,7 @@ if __name__ == "__main__":
34
  host=host,
35
  port=port,
36
  log_level="info",
37
- reload=False
 
 
38
  )
 
34
  host=host,
35
  port=port,
36
  log_level="info",
37
+ reload=False,
38
+ forwarded_allow_ips="*", # Allow all proxy IPs for HuggingFace
39
+ proxy_headers=True # Trust proxy headers from HuggingFace
40
  )