How to use Streamlit with Nginx?

@Anh_Chu Having the same problems as you do. Any ideas?

I’m using a reverse proxy with Nginx based on @virusvn recommendation on configuration: if I visit using IP:<streamlit-port> everything works just fine, if I visit going through Nginx IP/app (where I redirect to IP:<streamlit-port> with Nginx, it succesfully redirects, but streamlit remains stuck in Connecting... Please Wait. Nginx logs shows 403 forbidden errors on /healthz.

I’m using streamlit 0.56, and using Docker with docker-compose and 2 services: one container to deploy the app, and one container for nginx. They are both part of the network created by default, so callable by their service name.

Update:

The nginx configuration here helped me: Host streamlit app at a subfolder . The problem was that I was redirecting IP/app to IP:<streamlit-port> but I was doing so for the stream endpoint without prefixing with app. I set the location block to /app/stream/ (like in the list of the answer), and it worked.

2 Likes