How to troubleshoot an eternal "Please wait..." from nginx configuration?

Aha, I finally figured this out from here! Any changes regarding websocket for Streamlit v1.14 vs. 1.18? - #2 by andfanilo

Between versions of streamlit, the endpoint /stream was changed to /_stcore/stream. So anywhere the nginx configuration has the former had to be replaced with the latter. Now it seems to be working again fine!

UPDATE: If you think you have the configuration right, but itโ€™s still not working for you, see if it works on another machine.

Even with the proper endpoint again, the nginx configuration for the virtual machine hosting my webapp was not working as expected (blank screen) after I cleared my local browser cache this morning. However, it was working great on my test virtual machine. Presumably the issue was some kind of caching with nginx and clearing the nginx cache or uninstall/reinstall may have helped, but I had difficulty finding my nginx cache, as apparently I configured it to be somewhere other than the default location at some point. (In my case, it was pretty trivial to just move production to the test machine, so I did not debug further.)

Also including my final configuration file to make this as easy as possible for folks going forward:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        root         /usr/share/nginx/html;

        client_max_body_size 20M;

        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }

        location / {
            auth_basic "restricted";
            auth_basic_user_file .htpasswd;
            proxy_pass http://127.0.0.1:8501/;
        }

        location ^~ /_stcore/static {
            proxy_pass http://127.0.0.1:8501/static;
        }

        location ^~ /_stcore/healthz {
            proxy_pass http://127.0.0.1:8501/_stcore/healthz;
        }

        location ^~ /_stcore/vendor {
            proxy_pass http://127.0.0.1:8501/_stcore/vendor;
        }

        location /_stcore/stream {
            proxy_pass http://127.0.0.1:8501/_stcore/stream;
            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_set_header Sec-WebSocket-Extensions $http_sec_websocket_extentions;
            proxy_read_timeout 85400;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }

}
2 Likes