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

AxiosError: Request failed with status code 403 I am also getting this would request a quick fix

2 Likes

can you please provide the solution for it, any screenshot of the code. It would really help me.

1 Like

Same for me. I upgraded to 1.31.0 with no succes.

Please provide a solution

Setting enableCORS = false is not an acceptable solution

Thanks

1 Like

Hello there,

I was strugging with the same issue from last week.

I downgrade from 1.30.0 to 1.29.0 and today I upgrade to 1.31.0 the problem sloved.

Also I updated the line in my config.toml file:

I added:

[server]
enableXsrfProtection=false

I am using Mac with

Streamlit version: 1.31.0
Python: 3.9.0

Hope this help.

Thanks and regards,
majid Liaquat

This is not a desirable solution. It lowers security level of the App.

https://discuss.streamlit.io/t/when-to-use-enablecors-and-enablexsrfprotection-parameters/32075/7

2 Likes

I am a beginner, how exactly do I do this from anaconda prompt

1 Like

You don’t. You use a text editor instead.

I am also facing this error locally.Also I am unable to find config.toml in my local library setup

1 Like

You may need to create it yourself.

I started receiving the same error after enabling authentication.
Streamlit v1.32.2

Will a fix be deployed, or do we have to update our enableXsrfProtection setting?

2 Likes

Hello
same problem here for the first time
return to version 1.29.0 solve the problem for me

2 Likes

i see a lot of people with this problem
its break every prod app i deploy for client and we cant at this time use last version of streamlit …
ist it possible for streamlit staff to answers quickly to this probleme pls ?

1 Like

Thanks a ton, this solved it for me.

1 Like

Thank you! 1.29.0 fixed the issue.

1 Like

Hi @ctaboo,

1.29.0 should have fixed the issue. Can you try downloading the latest version and see if that works?

pip install --upgrade streamlit

Thanks,
Charly

1 Like

If 1.29.0 fixed the issue, was the fix removed from later builds?
I have the same issue on 1.32.2. The error occurs after I enable App Service authentication.

1 Like

The issue persists even with 1.29.0.

1 Like

I wanted to share that myself and colleague both using file uploader (Streamlit, version 1.32.2) for local running. It works on my mac and not on his

uploaded_file = st.file_uploader("Choose a file")

# "Process Document" button should be inside the 'with tab3:' context
if st.button("Process Document"):
    st.write("Process Document button clicked")  # Display in UI
    if uploaded_file is not None:

I pulled the error message from his developer consoler on Chrome as attached…

1 Like

If you are running it locally try:
streamlit run app.py --server.enableXsrfProtection false

from: https://stackoverflow.com/questions/78019438/axioserror-request-failed-with-status-code-403-in-streamlit

5 Likes

!streamlit run app.py --server.enableXsrfProtection false
This will work fine :slight_smile:

2 Likes