I’m a DevOps engineer working with AWS cloud, and I’m following a project where I need to deploy a Streamlit application on Internet through AWS.
We got the error: “Error: Request failed with status code 403” after uploading a file through the file_uploader. It turns out that the error was the Application Load Balancer in front of the server hosting Streamlit. The Application Load Balancer was protected by Web Application Firewall rules, and one of these blocks all the packets that has a body larger than 8 KB (typical of file upload). The name of the AWS WAF rule was SizeRestrictions_BODY.
By disabling this rule, everything worked fine. Don’t know if this can be helpful for whoever has issues in exposing Streamlit from cloud environments.
Do you have anything between your app and the users on Azure?
Try turning off XSRF protection by adding:
enableXsrfProtection = false
to streamlit/config.toml, or --server.enableXsrfProtection=false to the run command. Note that this is not really a recommended long-term / production use; I figure I am safe enough just by having an AD authentication requirement and a small & trusted user pool.
Here are some other topics on the problem, including my own. I have not been able to get a satisfying solution yet:
I have a low-confidence suspicion that this is caused by the _xsrf token not getting through. I opened up an issue here but I might be way off my base as webdev stuff is not my forte.
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.