Accessing Streamlit through reverse proxy results in "Please wait..." [SOLVED]

Dear all,

I’m having troubles deploying a streamlit application: The site can be accessed w/o problems when using its original port (8080) but not when accessing it through a reverse proxy (running on port 443 since encryption is required for authentication). When accessing the site through the proxied connection, the infamous “Please wait…” is displaed.

The reverse proxy is implemented through nginx with the following simple configuration as suggested in other posts:

server {
    listen       443 ssl http2 default_server;
    listen       [::]:443 ssl http2 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    ssl_certificate           "/etc/pki/nginx/self-signed.crt";
    ssl_certificate_key       "/etc/pki/nginx/private/self-signed.key";
    ssl_session_cache         shared:SSL:1m;
    ssl_session_timeout       10m;
    ssl_ciphers               HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        proxy_pass http://127.0.0.1:8080;
    }

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

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

Following other posts (e.g. How to use Streamlit with Nginx?) I have added enableCORS = false and also enableXsrfProtection=false which seems to be required, too. The full ~/.streamlit/config.toml is

[server]
port = 8080
enableCORS=false
enableXsrfProtection=false

[browser]
gatherUsageStats = false

In the Firefox console I repeatedly get the following errors

Firefox can't establish a connection to the server at ws://SERVER/stream. 
The connection to ws://SERVER/stream was interrupted while the page was loading.

The issue also appears if the proxy is running on port 80. The used streamlit version is 0.71.0, the site is running on a CentOS 7.4 system with nginx 1.16.1 installed.

Am I missing a point in the proxy configuration?

It seems I was indeed. Found the solution in Streamlit, docker, Nginx, ssl/https (missing settings for the /stream location)

1 Like

Glad you figured it out, welcome to the Streamlit community!