AxiosError: Request failed with status code 403

Summary

Hi

I try to upload file in replit.com with streamlit. However after upload the file, it reply the * AxiosError: Request failed with status code 403
Is there anyone have the same issue?
Thank you so much for your help.

Code snippet:


import streamlit as st

uploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=True)
for uploaded_file in uploaded_files:
    bytes_data = uploaded_file.read()
    st.write("filename:", uploaded_file.name)
    st.write(bytes_data)

5 Likes

I am having the same problem. my code was working until yesterday but not working after upgrading to the latest version…

2 Likes

Hey guys, Iam having the same issue, just after upgrade to streamlit 1.20

2 Likes

I’m getting the same error while trying to upload csv files…

2 Likes

Same error for me when uploading a large CSV

1 Like

clearing browser history and cookies fixed the issue for me.

1 Like

I figure out how fix this problem. The problem appear when you are using a different domain from Heroku or other cloud service and you are masking it with your domain.

To solve this you can change App url or disable CORS and XSRF on Heroku. This last option is easy, just add this code on your setup.sh:

mkdir -p ~/.streamlit/
echo "\
[server]\n\
headless = true\n\
port = $PORT\n\
enableXsrfProtection=false\n\
enableCORS = false\n\
\n\
" > ~/.streamlit/config.toml

Please, think about the new risk you are opening up in you app if you disable CORS and XSRF.

2 Likes

Did someone fixed it on replit?

2 Likes

pip install streamlit==1.24.0 . Use this earlier version. It fixed the problem for me

3 Likes

Hey,
We still face this issue with 1.24.1

1 Like

I got it working on replit. Create a new folder called .streamlit and create a “config.toml” file inside it. Then add this to the file:

[server]
enableXsrfProtection = false
enableCORS = false
22 Likes

Saved me hours of debugging! I all ready had this enabled in a different environment and I only needed to apply it to a new one. Thank you very much!

1 Like

Great, how did you come up with this solution. It resolved the issue

2 Likes

It worked for me. Thank you!

1 Like

I am also getting the same error any one got the solution

1 Like

Can you please share the process

1 Like

Thank you for your help

1 Like

Thanks ,It worked

1 Like

Thanks, It worked:)

1 Like

This is still happening in 1.35.0

Host: Azure web services
Authorization : I have tried both MS and GitHub, both have the issue. It works if I disable Authentication.

The config.toml file has the following:

[server]
enableXsrfProtection = false
enableCORS = false