File upload fails with Error: Request failed with status code 403

Same problem here

MacOS 15.1.0
Python 3.11.10
streamlit 1.40.1

Hi, I have a similar issue: “AxiosError: Request failed with status code 403”
image
My application (running locally) worked fine last month when I last used it. Starting today (1/2/25) there is now an issue. I have not modified any packages in this time frame.
Any ideas on what could have changed or what may be causing the issue?
Streamlit 1.38

i had same error using iframe did you solve it ?

Same having issue when embedded in iframe. Anyone able to resolve? Disabling xsrf didn’t help

I faced this Axios error when deploy app as Azure Web App using python deployment.

I was able to resolve that error long time ago by using CICD pipeline with

startUpCommand: 'python -m streamlit run ./src/Home.py --server.port 8000 --server.address 0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false'

And adding following into Azure wep app configs (startup command):

python -m streamlit run ./src/Home.py --server.port 8000 --server.address 0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false

But for some reason the error got back when all three conditions meet:

  1. app deployed as azure web app AND
  2. user enable corporate vpn AND
  3. use upload file with size 10mb or more.

After many attempts and I found that it happens if app deployed in US (e.g. US West 2). When I deployed azure web app in Canada Central the error went away.

For reference here is my Azure Web App setup:




streamlit 1.44.0