St.file_uploader() AxiosError: Request failed with status code 404

Hi everyone,

I’m facing an issue when trying to upload files (pdf, html, png) when using the streamlit st.file_uploader() function. After trying several suggested solutions from this forum, it is still not working. What could be the issue?

Issue Summary

  • Context: Attempting to upload files (PDF, HTML, PNG) using st.file_uploader() in a Streamlit app deployed behind a Kong API gateway.
  • Error Message: AxiosError: Request failed with status code 404
  • Endpoint Triggered: https://website_url.com/_stcore/upload_file/ (returns 405 Method not allowed)
  • Streamlit Version: streamlit==1.38.0
  • Tornado Version: tornado==6.4.1
  • Python Version: 3.9

What i’ve tried:

  1. Kong Configuration: Ensured that POST is included as an allowed method in my Kong route configuration.
  2. CORS Configuration: Adjusted CORS settings, including temporarily allowing all origins.
  3. Local Testing: Ran the Streamlit app locally (without Kong) to confirm that the file upload functionality works as expected.
  4. XSRF Protection: Tried turning off XSRF protection in the Streamlit configuration.