Websocket connection fails with apache2

Hi,

I am trying to deploy an app with apache2.

If β€œip” is my ip, here is the config :

Apache 2 :

<VirtualHost *:80>
   ServerName ip

   RewriteEngine On

   RewriteCond %{HTTP:Upgrade} =websocket
   RewriteRule /twitter/(.*) ws://localhost:8501/$1 [P]
   RewriteCond %{HTTP:Upgrade} !=websocket
   RewriteRule /twitter/(.*) http://localhost:8501 [P]

   ProxyPassReverse /twitter/ http://localhost:8501
</VirtualHost>

I launch with this command :
streamlit run index.py --server.enableCORS=false --server.enableXsrfProtection=false

But I still have :
WebSocket connection to ws:ip/twitter/stream failed

Thank’s for the help !

hey, do you already have the solutions from this issue?

1 Like

Bro I am also having this kind of problem, my web app keep refreshing after reaching the server request timeout of 300 seconds.

I’m getting a WebSocket connection to 'wss://mydomain.com/_stcore/stream' failed: error on streamlit home page after deployment with apache as well. My project had nothing to do with websockets.

OP, did you copy code from this tutorial by any chance?. I’m thinking it may be something due to its configs… Any solution?