Unable to get SSL working with reverse proxy [Unraid, DuckDns, LetsEncrypt/NGINX]

my site-confs/default file:

map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}

# Redirect all http traffic to https
server {
    listen 80;
    server_name url.duckdns.org;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl default_server;

    root /config/www;
    index index.html index.htm index.php;

    server_name url.duckdns.org;

    ssl on;

    ssl_certificate /config/keys/letsencrypt/fullchain.pem;
    ssl_certificate_key /config/keys/letsencrypt/privkey.pem;
    ssl_dhparam /config/nginx/dhparams.pem;
    ssl_ciphers <CIPHERS>
    ssl_prefer_server_ciphers on;

    client_max_body_size 0;

    proxy_buffering off;

    # Home Assistant
    location / {
        proxy_pass http://192.168.1.111:8123/;
        proxy_set_header Host $host;
        proxy_redirect http:// https://;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }

    location /api/websocket {
        proxy_pass http://192.168.1.111:8123/api/websocket;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

Running hass in ‘host’ mode on unraid. Can access it locally using the direct ip:8123. Just can’t have it play nice with nginx apparently…

I’ve tried dozens of different changes I’ve found online and nothing seems to work.

Was able to get this working for anyone else that runs into the issue:

upstream backend {
server 192.168.0.111:19999;
keepalive 64;
}

map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}

server {

listen 443 ssl default_server;
root /config/www;
index index.html index.htm index.php;

server_name www.duckdns.org;

ssl_certificate /config/keys/letsencrypt/fullchain.pem;
ssl_certificate_key /config/keys/letsencrypt/privkey.pem;
ssl_dhparam /config/nginx/dhparams.pem;

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers <'Ciphers'>
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;

proxy_buffering off;

client_max_body_size 0;

location / {
   proxy_http_version 1.1;
   proxy_set_header        Upgrade $http_upgrade;
   proxy_set_header        Connection "upgrade";
   proxy_set_header        Host $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;

   # Fix the “It appears that your reverse proxy set up is broken" error.
   proxy_pass          http://192.168.0.111:8123;
   proxy_read_timeout  90;

   proxy_redirect      http://192.168.0.111:8123    https://hass.duckdns.org;
}    

location /sonarr {
    include /config/nginx/proxy.conf;
    proxy_pass http://192.168.0.111:8989;
}

location /radarr {
    include /config/nginx/proxy.conf;
    proxy_pass http://192.168.0.111:7878;
}

location /ombi {
    include /config/nginx/proxy.conf;
    proxy_pass http://192.168.0.111:3579/ombi;
}

}

1 Like

Thank you so much for this.

Worked for me as well.