ananyajoshi commited on
Commit
b048ded
·
verified ·
1 Parent(s): 6303ae6

Fix: disable XSRF/CORS so file uploads work behind HF proxy (403 fix)

Browse files
Files changed (1) hide show
  1. .streamlit/config.toml +10 -9
.streamlit/config.toml CHANGED
@@ -15,15 +15,16 @@ font = "sans serif"
15
  toolbarMode = "minimal"
16
 
17
  # --- Server settings -------------------------------------------------------
18
- # Production-safe defaults for a shared deployment (Hugging Face Space):
19
- # XSRF protection is ON and CORS is left at its secure default. Hugging Face
20
- # serves Streamlit same-origin behind its proxy, so st.file_uploader works
21
- # with XSRF enabled.
22
  #
23
- # LOCAL DEV NOTE: if you run from a proxied / non-standard local setup and see
24
- # a browser "AxiosError: Request failed with status code 403" on upload, set
25
- # enableXsrfProtection = false (and enableCORS = false) locally only — do NOT
26
- # commit those values for the deployed Space.
27
  [server]
28
  maxUploadSize = 50 # max upload size per file, in MB (dossier + screenshot)
29
- enableXsrfProtection = true # keep ON for any shared/public deployment
 
 
15
  toolbarMode = "minimal"
16
 
17
  # --- Server settings -------------------------------------------------------
18
+ # st.file_uploader is core to this app (dossier files + job screenshot). Behind
19
+ # Hugging Face's reverse proxy, Streamlit's XSRF check rejects the upload POST
20
+ # with "AxiosError: Request failed with status code 403", so both XSRF and CORS
21
+ # are disabled here to make uploads work on the Space.
22
  #
23
+ # Security note: this is acceptable for THIS app because there is no persistent
24
+ # server-side session to forge against — each visitor supplies their own API
25
+ # key, held only in their own in-memory session, and nothing is stored
26
+ # server-side. There is no privileged state a cross-site request could abuse.
27
  [server]
28
  maxUploadSize = 50 # max upload size per file, in MB (dossier + screenshot)
29
+ enableCORS = false # required alongside the XSRF setting below
30
+ enableXsrfProtection = false # clears the 403 upload error on Hugging Face