Streamlit Application Deployment Execution Issue: Blank Page Displayed in Browser

I deployed my Streamlit application on a virtual machine within an intranet, but I’m experiencing an issue with some users. They can only see a blank page, and it keeps loading indefinitely.

I suspect the problem might be related to the port, as Streamlit usually uses ports 8501 or 8502. What steps can I take to resolve this?

Thanks :slight_smile:

A blank screen typically indicates that the frontend website is unable to establish a WebSocket connection with the backend Streamlit server. The most prevalent cause of this issue is a misconfiguration of the reverse proxy.

To diagnose the issue, you should inspect the browser logs and analyze the network requests on the “Networks” tab of the browser developer tools.

I have the same issue, and in fact the problem seems to be related to the WebSocket connection… On my local PC browser, I see this error:

WebSocket connection to 'wss://XXXXXXXX/_stcore/stream' failed:

Here is my NGINX config file:



#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8501; #80
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
		location /stream {
			proxy_pass  http://127.0.0.1:8501/stream;
			proxy_http_version 1.1;
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    server {

        server_name XXXXXXX;#my_domain

        listen [::]:443 ssl; # managed by Certbot
        listen 443 ssl; # managed by Certbot

        ssl_certificate "C:\Users\YYYYYYYY\cert.pem"; # managed by Certbot
        ssl_certificate_key "C:\Users\YYYYYY\key.pem"; # managed by Certbot
        #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        keepalive_timeout 10;

        location / {
            proxy_pass http://127.0.0.1:8502/;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_redirect off;
            proxy_http_version 1.1;

            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 86400;
        }

        location /_stcore/stream {
            proxy_pass http://127.0.0.1:8502/_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 86400;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        # location ^~ /healthz {
        #     proxy_pass http://127.0.0.1:8502/healthz;
        # }

    }

}



And my Streamlit config file:

[server]
port = 8502
enableCORS = false
enableXsrfProtection = false
headless = true

Any help please?