Streamlit does not work correctly behind a reverse proxy if a trailing slash is omitted
See original GitHub issueSummary
When Streamlit is behind a reverse proxy, it won’t work if a trailing slash is not included.
Steps to reproduce
Setup nginx with the following nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 5000;
server_name localhost;
location /my_prefix/another {
rewrite /my_prefix/another/(.*) /$1 break;
rewrite /my_prefix/another / break;
proxy_pass http://localhost:8501;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
Run streamlit on localhost.
Access streamlit at http://localhost:5000/my_prefix/another
Expected behavior:
You can access Streamlit
Actual behavior:
Not able to access Streamlit. Path to static resources are broken. They miss a part of the rewrite rule:
Additional information
- Addign a trailing slash as http://localhost:5000/my_prefix/another/ fixes this problem.
- This may show up with other reverse proxy than nginx.
- A quick fix is to add a redirect rule to the address with the trailing slash.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Accessing Streamlit through reverse proxy results in "Please ...
I'm having troubles deploying a streamlit application: The site can be accessed w/o problems when using its original port (8080) but not when ......
Read more >Streamlit behind revese proxy doesn't work when you change ...
I am trying to run streamlit behind reverse proxy. I have following situation which works behind reverse proxy: 1.streamlit hello --server.
Read more >Media path for nginx? - Deploying Streamlit
I would be curious to see if there is any problem in the way we ... and with and without trailing slash at...
Read more >How to use Streamlit with Nginx?
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> ......
Read more >Using streamlit behind a reverse proxy
I think the problem you're hitting is related to the path user/streamlit . Right now Streamlit apps need to be at / ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem. Even when serving at / I just get a blank page.
I also have this issue when using K8s ingress.