I have a streamlit app running on 8501 port on localhost, I have configured a apache reverse proxy to expose this app outside on 443 port, Here’s the configuration for that:
<VirtualHost *:443>
ServerName streamlit-app-test.domain.com
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization, sap-contextid-accept, MaxDataServiceVersion, x-csrf-token, sap-cancel-on-close, DataServiceVersion,x-sap-cid,access-control-allow-origin,access-control-allow-credentials, Host, X-Real-IP, X-Forwarded-For, X-Forwarded-Proto "
Header set Access-Control-Allow-Credentials "true"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT, PATCH"
Header set Access-Control-Expose-Headers "x-csrf-token, x-sap-cid, content-type, authorization, accept, x-request-with"
ProxyPreserveHost On
ProxyPass / http://localhost:8501/
ProxyPassReverse / http://localhost:8501/
ProxyPass /ws/ ws://localhost:8501/
ProxyPassReverse /ws/ http://localhost:8501/
ErrorLog /opt/lampp/logs/error_log_test
CustomLog /opt/lampp/logs/access_log_test combined
</VirtualHost>
When I load it locally like http://localhost:8501/ but when I try to browse it through https://streamlit-app-test.domain.com/ I get the following error
main.1661a802.js:2 WebSocket connection to 'wss://streamlit-app-test.domain.com/_stcore/stream' failed:
I see that in the sources tab of developer tools in chrome cdn.segment.com is present while loading it through http://localhost:8501/ but not through https://streamlit-app-test.domain.com/
I have also enabled mod_proxy_wstunnel by adding following line in /opt/lampp/etc/httpd.conf file
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
I have also enabled CORS in streamlit but adding following line to /.streamlit/config.toml file but not sure how to verify if CORS is enabled or not
[theme]
base="dark"
enableCORS = true
What am I missing?