Configuring Apache 2.4 for proxy

In your case, I believe you are viewing partial content because the websocket is not getting forwarded. streamlit is relying on websockets for transporting its data.

Now, I have the full configuration that works even over https
https://dashboard-aircare.mapshalli.org/

<VirtualHost *:80>
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =dashboard-aircare.mapshalli.org
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
   ServerName dashboard-aircare.mapshalli.org

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

    SSLCertificateFile somepath
    SSLCertificateKeyFile someotherpath
</VirtualHost>

We are permanently directing from http:80 to https:443 and then proxying https:443 to http:8501 and ws:8501

6 Likes