Change base url of the websocket

Hello,

I’m trying to reach my streamlit app which is deployed in a docker container behind a load balance and nginx.
So, to reach this application a dynamic route is created, the base url to reach application is something like https://base.url.com/app-65

But I’m facing the following error from my browser console :

WebSocket connection to ‘wss://base.url.com/stream’ failed: Error during WebSocket handshake: Unexpected response code: 200

Here I think that this error is due of the base url from the websocket which is wrong.

Is there any way to change the base url for websocket ?
Like from ‘wss://base.url.com/stream’ to ‘wss://base.url.com/app-65/stream’

Best regards.

1 Like

Hi @folly

You’re in luck! We just merged a fix for this a few days ago: https://github.com/streamlit/streamlit/pull/454

This means that when we release Streamlit 0.49.0 in a few days you’ll be able to fix this by setting the following config option in ~/.streamlit/config.toml:

[server]
baseUrlPath = 'app-65'
1 Like

Can the new baseUrlPath config be set by environment variable or as an argument to streamlit run?

1 Like

@thiago Great news!

@kinghuang Yes! this feature will be very useful in my use cases too if we can set config.toml variables through environment variables.

@folly I have a PR in progress here about environment variables: https://github.com/streamlit/streamlit/pull/477