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)

2 Likes

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

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

1 Like

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

1 Like

Same error for me when uploading a large CSV

clearing browser history and cookies fixed the issue for me.

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.

Did someone fixed it on replit?

1 Like

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

1 Like

Hey,
We still face this issue with 1.24.1

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
1 Like

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!