[Digital Ocean] Possible to change relative paths for static assets?

First up - thank you, the Streamlit app is great and very helpful to get ideas to production quickly.

We’re using Digital Ocean’s app platform to deploy Streamlit. As part of this, we’re using their HTTP Routes feature to deploy to a “subfolder” path (eg http://my.domain.com/streamlit). They deploy Streamlit via a Docker container to this path, and we don’t have any control over the webserver beyond this. We have got this working OK via the command line option --server.baseUrlPath=/streamlit

Our problem:

  • Streamlit’s asset path is prepended with a “.” (eg href="./favicon.png")
  • This works fine when the app is at root (/) or a URL terminated with a slash
  • It doesn’t work using DO’s default serving method of leaving the final forward slash off the url and it doesn’t resolve these paths correctly. The dot makes it go looking up a level to the root of the domain, which it would do if there was just a forward slash in the path.

A possible solution is to either override this behaviour within Streamlit via a command line option or via editable templates that work with a Dockerfile pipeline (where we can’t edit the source of deployed code).

Is this possible at all, or has anyone got a workaround? Other than telling users to add the slash themselves, which doesn’t scale.

What sorts of static assets are you referencing, and how are you referencing them currently in your app?

I mean the standard Streamlit assets - JS files, favicon, CSS, etc. These are outside of our control and included in the Streamlit package somewhere but I can’t edit them directly due to the remote Docker builds.

If we were running our own webserver, we’d add a rewrite rule to always add a forward slash to the path, but we don’t have that option either with D.O.'s app platform.

I could in theory look to duplicate these templates from the Streamlit package and add steps in the Dockerfile to overwrite them in the container, but was hoping there would be a more simple approach.