App stuck on "Please wait..." on VPS with Apache2

Hey there,

I’m trying to deploy my app and all was great but I’m getting constant “Please wait…”.
Here is what I’m getting in browser console:

WebSocket connection to 'ws://<URL>' failed: WebSocket is closed before the connection is established.

WebSocket connection to 'ws://<URL>' failed: WebSocket is closed before the connection is established.

Uncaught Error: Unsupported state transition.
State: PINGING_SERVER
Event: CONNECTION_TIMED_OUT
    at e.value (main.a8683c40.chunk.js:2:120961)
    at main.a8683c40.chunk.js:2:123059

I think tried everything what is online like:

Running these things:

streamlit run my_app.py --server.enableCORS=false
streamlit run my_app.py --server.enableWebsocketCompression=false

Adding this to streamlit config:
serverPort = 8502

Changing mydomain.com to server_ip also didn’t help

and all other things found online also were tried.

Here is my app.domain.com.conf of apache2:

<VirtualHost *:80>
        ServerAdmin admin@domain.com
        ServerName app.domain.com
        ServerAlias app.domain.com
        ProxyRequests Off
        <Location />
                ProxyPass http://app.domain.com:8502/
                ProxyPassReverse http://app.domain.com:8502/
                ProxyPreserveHost On
        </Location>
     # Uncomment the line below if your site uses SSL.
     #SSLProxyEngine On
</VirtualHost>

Here is my ports.conf

Listen 80
Listen 8501
<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

On my main domain I’m hosting the landing page (port 80) and on app.mydomain.com (port 8502) streamlit app

What could be the issue here? Thank you!

1 Like

After weeks of being stuck, trying, and failing, I resolved the “Please wait…” issue on Apache2 by running the following: sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8502 (via aalbinati’s response on Streamlit is stuck after redirecting port with Apache and Nginx · Issue #1555 · streamlit/streamlit · GitHub). While this post is old, I’m sharing this in case the OP still have this question, or in case others having the same issue run across this post, as I did at least 3 times, hoping for an answer. In this line of code, adjust the port to whichever ort you are using. Set to 8502 here since OP is using that, but by default it will be 8501 for most folks.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.