Websocket-disconnected error in selfhosted SpeckleServer

Hi All,

I installed the SpeckleServer 1 in a Ubuntu 20.04.1 with NGINX 1.18.0 as HTTPS proxy.
If I connect the browser to the URL https://speckle.mydomain.com all works fine but unfortunately, the Grasshopper tools still give me the error websocket-disconnected.

I think that the problem is on the NGINX configuration but I can’t understand where is the error. My conf file is the following

server {
            listen 80;

            location / {
                    return 301 https://$host$request_uri;
            }
    }

    map $http_upgrade $connection_upgrade {
            default upgrade;
            '' close;
    }

    upstream websocket {
            server 127.0.0.1:3000;
    }
    server {
            # SSL configuration
            listen 443 ssl;
            server_name osm.maffeis.it;

            ssl_password_file /etc/ssl/private/MyDomain_com.pass;
            ssl_certificate /etc/ssl/certs/MyDomain_com.pem;
            ssl_certificate_key /etc/ssl/private/MyDomain_com.key;

            ssl_dhparam /etc/nginx/dhparam.pem ;
            ssl_ciphers  "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!EXPORT:!RC4:!aNULL:!MD5:!DSS:!eNULL:!DES:!3DES";
            ssl_prefer_server_ciphers on;
            ssl_protocols TLSv1 TLSv1.1  TLSv1.2 TLSv1.3;

            gzip on;
            gzip_proxied any;
            gzip_types text/plain text/xml text/css application/x-javascript application/json;
            gzip_vary on;
            gzip_disable "MSIE [1-6]\.(?!.*SV1)";

            error_log /var/log/nginx/speckle.log debug;

            location / {
                    # http trafic
                    proxy_pass http://127.0.0.1:3000;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                    proxy_set_header X-Forwarded-Proto $scheme;
                    proxy_pass_request_headers on;

                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection $connection_upgrade;
            }

Can someone help me, please?
Thanks in advance
Giorgio

1 Like

Hi @ME-Giorgio-Todeschin! Your nginx config looks a bit weird, but I haven’t looked at these things in quite a while so maybe I’m rusty.

Here’s my config block for hestia:

server {
	# SSL configuration
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	root /root/apps/SpeckleHestia/static;

	server_name hestia.speckle.works;

	gzip on;
	gzip_proxied any;
	gzip_types text/plain text/xml text/css application/x-javascript application/json;
	gzip_vary on;
	gzip_disable "MSIE [1-6]\.(?!.*SV1)";

	location ~ /.well-known {
        	allow all;
    	}

	location / {
		#allow for longer requests (5 minutes)
		proxy_read_timeout 300s;
		#http trafic
		proxy_pass http://localhost:3030;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

		#ws support
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
	}


    ssl_certificate /etc/letsencrypt/live/hestia.speckle.works/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/hestia.speckle.works/privkey.pem; # managed by Certbot
}

Just to emphasize - this is just a server block for nginx that is stored in /etc/nginx/sites-available and symlinked into etc/nginx/sites-enabled! You can read more about server blocks here.

Let me know if this helps!

Dear Dimitrie, first of all, thanks for your help.

I performed many many tries and at this point, I think that the problem is that not on the 443 port configuration but on redirecting the traffic from 80 to the 443 port.

Could you please show me how is the rest of your NGINX conf file? Better could be if you could to show me the entire NGINX configuration file.

Thanks in advance.
Giorgio