Streamlit 1.4.0 deployed as a docker container, listening on port 8051, on an ec2 instance. Apache 2.4.18, on another node, is a reverse proxy to the streamlit app. Apache’s proxy, proxy_http and proxy_wstunnel modules are enabled.
Errors:
“Please wait…” - message on the browser when the proxy URL is hit. The app loads fine when it’s accessed directly via http://<ec2_host_fqdn>:8051 though.
WebSocket connection to 'wss://streamlit-weekly.proxy.app.info/stream' failed: WebSocket is closed before the connection is established.
Uncaught Error: Unsupported state transition.
State: PINGING_SERVER
Event: CONNECTION_TIMED_OUT
at Po.stepFsm (main.cb6e038a.chunk.js:2:491430)
at main.cb6e038a.chunk.js:2:494477
Apache vhost:
<VirtualHost *:443>
ServerName streamlit-weekly.proxy.app.info
## Vhost docroot
DocumentRoot "/var/www/html"
## Directories, there should at least be a declaration for /var/www/html
<Directory "/var/www/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
## Logging
ErrorLog "/var/log/apache2/streamlit-weekly.proxy.app.info_error_ssl.log"
ServerSignature Off
CustomLog "/var/log/apache2/streamlit-weekly.proxy.app.info_access_ssl.log" combined
## Proxy rules
ProxyRequests Off
ProxyPass / http://streamlit01.app.us-west-2.private:8501/
ProxyPassReverse / http://streamlit01.app.us-west-2.private:8501/
<Location "/stream">
ProxyPass wss://streamlit01.app.us-west-2.private:8501/stream
ProxyPassReverse wss://streamlit01.app.us-west-2.private:8501/stream
</Location>
## SSL directives
SSLEngine on
SSLCertificateFile "/etc/ssl/certs/ssl-cert-snakeoil.pem"
SSLCertificateKeyFile "/etc/ssl/private/ssl-cert-snakeoil.key"
SSLCACertificatePath "/etc/ssl/certs"
SSLProxyEngine On
</VirtualHost>
I referred quite a number of posts but I wasn’t able to find anything specific to Apache’s reverse proxy settings. Any help will be appreciated.
I am having a similar issue. I created a streamlit app and dockerized it. Now trying to reverse proxy my Apache server to connect to this docker container. But, the browser shows “Please Wait” and on inspecting the web page, the console shows the “Websocket connection failed”.
I am not well versed in how to upgrade the connection to websockets from my Apache SSL config.
Also, I am reverse proxying the docker IP to a subfolder rather than using the “/”. Like HTTP://my_server_name/my_awesome_app/
Also looking for a solution to this. Running a streamlit app on Ubuntu behind Apache2 with LetsEncrypt, says “Please wait…” forever and giving the same messages everyone shows here.
This still happens when I start the app using streamlit run app.py with the flags
all the variations of different ReverseProxy settings including the ones on this page.
Still no luck.
To the more savy, info from the logs might be useful. In there (/var/logs/apache2/error.log) I found repeated entries of
[proxy_http:error] [pid 2901776:tid 140256410052160] [client XX.XX.XX.XX:XXXXX] AH01114: HTTP: failed to make connection to backend: 0.0.0.0, referer: https://my.domain.com/
Does that make sense to anyone?
Also just something I noticed: When i start the app from vscode on the remote, vscode can open the app with a forwarded port without a problem. At this point I am rather clueless but hope, that this can somehow help in finding the issue.
This solution helped, but then it’s stripping logged-in user details from request headers. Could you please tell how to get them? I need to grant the access based on user roles.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.