Modify base rout (root path) in Streamlit

Hi,

Is is possible to change the base routing from streamlit. I am trying to deploy it as a container, but I donโ€™t have a hand on the proxy server that is routing the request to the streamlit container. Therefore the proxy forwards the request to the streamlit container to <container ip>/<app name>, while streamlit expects the request at <container ip>/ and then I get the 404 for js and html files that should be served by streamlit. In short my proxy does not strip the prefix from the route and streamlit responds with 404. Is it possible to change the default route and add a base route. In FastAPI you can for example set a root_path or use (mount) or in node usually you can set a base route, is there something similar for streamlit.

Thanks in advance!

I am having the same issue and would love to know if it is possible to modify this the root_path at which the application listens.

Hi @Swinx

Yep you can solve this by telling streamlit what is your base path. You can do it from running command:

streamlit run app.py --server.address=0.0.0.0 --server.port=5000 --server.baseUrlPath=/<your-base-path>

Or you can set it in the config toml file: Configuration - Streamlit Docs

Thank you! It works like a charm. :grinning: