'The Streamlit app stops with "Please wait... " and then stops

Problem

The app started by running streamlit run main.py will display http://IP_ADDRESS:8501 is displayed correctly, but http://DOMAIN_NAME stops with "Please wait... " and stops.

enter image description here

Environment

  • Domain name already resolved with Route53
  • Deploy Streamlit App on EC2 (Amazon Linux) and run Streamlit run main.py on Tmux
  • Use Nginx to convert access to port80 to port8501

Changed Nginx settings

/etc/nginx/nginx.conf

server {
        listen       80; #default
        listen       [::]:80; #default
        server_name MY_DOMAIN_NAME;
        location / {
          proxy_pass http://MY_IP_ADDRESS:8501;
        }
        root         /usr/share/nginx/html; #default

What I tried

I tried the following, but it did not solve the problem.

https://docs.streamlit.io/knowledge-base/deploy/remote-start#symptom-2-the-app-says-please-wait-forever

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

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



Solution 1:[1]

Try the following conf:

server {
    listen 80 default_server;
    server_name MY_DOMAIN_NAME;

    location / {
        proxy_pass http://127.0.0.1:8501/;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 86400;
    }

and then, use this command line:

streamlit run my_app.py --server.port 8501 --server.baseUrlPath / --server.enableCORS false --server.enableXsrfProtection false

Solution 2:[2]

If anyone is using Ambassador as their ingress to kubernetes you'll need to allow websockets. This is explained at https://www.getambassador.io/docs/edge-stack/latest/howtos/websockets/

But, you essentially need to add the following to your Mapping

allow_upgrade:
- websocket

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vinzee
Solution 2 goran