Issue on nginx proxy for hass and node-red container

I have hass and nod-rede containers on ubuntu (ip1). Worked fine locally.

I’m trying to setup nginx+letsencrypt on other ubuntu server(ip2) and trying to setup proxy for hass and node-red. The SSL setup is for all sub-subdomain of duckdns.org.

Below is the config for hass:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name myha.xxxxxxxxxx.duckdns.org;
    include /config/nginx/ssl.conf;
    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_homeassistant ip1;
        proxy_pass http://$upstream_homeassistant:8123;
    }

    location /api/websocket {
        resolver 127.0.0.11 valid=30s;
        set $upstream_homeassistant ip1;
        proxy_pass http://$upstream_homeassistant:8123;
        proxy_set_header Host $host;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

for node-red:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name nr.xxxxxxxxxx.duckdns.org;
    include /config/nginx/ssl.conf;
    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        proxy_pass http://ip1:1880/;
    }

    location /ui {
        include /config/nginx/proxy.conf;
        proxy_pass http://ip1:1880/ui;
    }
}

also in configuration.yaml file:

http:
  base_url: myha.xxxxxxxxxx.duckdns.org

Now hass seems to work fine using https://myha.xxxxxxxxxx.duckdns.org
But when loading https://nr.xxxxxxxxxx.duckdns.org, first it loads ok and showing my flow, but immediately it showing “lost connection to the server, reconnecting…”

What configuration do I missed? Thanks!

you ever get this solved? what you explained sounds like the issue I am experiencing.