Thanks for getting back to me. Yes, the webserver config was something I should really have included in my last post, but it always makes the post look a bit overwhelming so I decided to leave it until really needed!
I’m running nginx, currently just in a Docker container with streamlit in another container, just for proof of concept.
The relevant nginx config is:
location /myapp {
location /myapp/healthz {
proxy_pass http://host.docker.internal:8501/healthz;
}
location /myapp/stream {
proxy_pass http://host.docker.internal:8501/stream;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
proxy_pass http://host.docker.internal:8501/;
}
location ^~ /static {
proxy_pass http://host.docker.internal:8501/static/;
}
location ^~ /vendor {
proxy_pass http://host.docker.internal:8501/vendor;
}
(I’m not too sure where vendor needs to sit at the moment - it isn’t being requested)
The above all works correctly, as in the app functions correctly.
However, I think it would make sense for /static to really be requested by the browser at /myapp/static instead. This is likely to be by design in streamlit since you might want static to be treated globally and perhaps served through something more efficient for static files, or a content delivery network or something. Even/especially if there were multiple streamlit apps at different subfolders. By contrast the / and /stream endpoints have to be application specific.
But it would be even better if this can be configured in streamlit - just being able to tell it the base URL to access static files.
Thanks again!
Dan