Streamlit under Caddy proxy

Hello,

Iโ€™m trying to setup a server that uses Caddy to manage several streamlit demo.
My aim is to be able to do:

myserver.com/demo1
myserver.com/demo2

I think Iโ€™m in the right direction with the Caddy configuration.
This is the Caddyfile:

myserver:5000 

proxy /demo1 http://localhost:8501/ {
  without /demo1
}

The page loads the streamlit app, but then it is stuck in this loading:

Same behaviour with a simpler Caddyfile:

$ cat Caddyfile 
myserver:5000 

proxy / http://localhost:8501/ {
}

The streamlit app works normally if it is opened directly.

I tried the solution proposed here:

$ cat ~/.streamlit/config.toml 
[server]
enableCORS = false

But it doesnโ€™t work.

Do you have any suggestion?

1 Like

Found it.
I was missing the preset websocket in the Caddyfile

edit.

The option:

$ cat ~/.streamlit/config.toml 
[server]
enableCORS = false

Is necessary to make it work

1 Like

Thank you for your sharing, which helped me a lot!