raystermomo commited on
Commit
fe6e7af
·
1 Parent(s): 6cd1906

Disable XSRF/CORS so file uploads work behind HF proxy

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +3 -1
  2. Dockerfile +1 -1
.streamlit/config.toml CHANGED
@@ -1,7 +1,9 @@
1
  [server]
2
  headless = true
 
 
3
  enableCORS = false
4
- enableXsrfProtection = true
5
  maxUploadSize = 25
6
 
7
  [browser]
 
1
  [server]
2
  headless = true
3
+ # CORS/XSRF are disabled because the app runs behind Hugging Face's proxy/iframe,
4
+ # which blocks the XSRF cookie and makes file uploads fail with AxiosError(403).
5
  enableCORS = false
6
+ enableXsrfProtection = false
7
  maxUploadSize = 25
8
 
9
  [browser]
Dockerfile CHANGED
@@ -33,4 +33,4 @@ COPY --chown=user . .
33
  EXPOSE 7860
34
 
35
  # HF Spaces expects the app on the port declared as app_port in README.md (7860).
36
- CMD ["sh", "-c", "streamlit run core/app.py --server.port=${PORT:-7860} --server.address=0.0.0.0"]
 
33
  EXPOSE 7860
34
 
35
  # HF Spaces expects the app on the port declared as app_port in README.md (7860).
36
+ CMD ["sh", "-c", "streamlit run core/app.py --server.port=${PORT:-7860} --server.address=0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false"]