Problems deploying streamlit app with AWS Cloudfront

Hello guys,
I’m trying to deploying my streamlit app with AWS Cloudfront.
The streamlit server is dockerized and run in a ECS Service with an Application ELB without problems.
But when I’m trying to use Cloudfront with the ELB address as origin the application stay in a loop showing me “Please wait…” as in this image

In the console I can see that that every second are raised two errors:

  1. WebSocket connection to ‘’ failed: WebSocket is closed before the connection is established.
  2. main.cf1968bf.chunk.js:2 Uncaught Error: Unsupported state transition.

my current config.toml file is like this:

disableWatchdogWarning = false
sharingMode = “off”
showWarningOnDirectExecution = true

level = “info”

caching = true
displayEnabled = true


magicEnabled = true
installTracer = false
fixMatplotlib = true

folderWatchBlacklist =
fileWatcherType = “auto”
headless = true
liveSave = false
runOnSave = false
port = 8501
baseUrlPath = “”
maxUploadSize = 50

enableCORS = false
enableWebsocketCompression = false


serverAddress = “”
gatherUsageStats = false
serverPort = 8501


token = “pk.eyJ1IjoidGhpYWdvdCIsImEiOiJjamh3bm85NnkwMng4M3dydnNveWwzeWNzIn0.vCBDzNsEF2uFSFk2AM0WZQ”


keyPrefix = “”

I’ve tried several combinations of those three values


but don’t seems like a problem related to them.

Have you experencied something like this or do you have any idea?

same issue here, was curios if you solved the issue.

  • tried diff versions of ST 0.74, 0.72
  • disabled http2 in ALB
  • error persist if accessing docker image without ALB but site loads faster and don’t get stucked in wss error loop . triend Chrome, Firebox, Safari
    -healthz responds ok using ALB
    -using chrome incognito page seems to loads faster for the first time
    -ALB logs give a 404 for GET …443/static/js/ HTTP/1.1

firefox reports: Firefox can’t establish a connection to the server at wss://server/stream. main.cf1968bf.chunk.js:2:320763

The connection to wss://server/stream was interrupted while the page was loading. main.cf1968bf.chunk.js:2:320763

Any idea would be appreciated

Hi @Gabij,

unfortunately I wasn’t able to solve the issue.

Right now as temporary solution I’m assigning certificate to load balancer and routing the traffic from my domain to it.

I’ll update if I have some news.