Home assistant behind Nginx reverse proxy gives error when making calls

Tags: #<Tag:0x00007f326369ca20> #<Tag:0x00007f326369c840>

I have multiple services running behind a reverse nginx proxy. But I am having issues with home assistant. The UI loads but the calls don’t get forwarded and error out

Failed to call service homeassistant/turn_off. Unable to find service light/turn_off

I am running https://hub.docker.com/r/homeassistant/home-assistant on Unraid.

This is the nginx config. The site loads but gives errors when I try to turn on lights.

# make sure that your dns has a cname set for homeassistant and that your homeassistant container is not using a base url

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

    server_name ha.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /login;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_app homeassistant;
        set $upstream_port 8123;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

    location /api/websocket {
        resolver 127.0.0.11 valid=30s;
        set $upstream_app homeassistant;
        set $upstream_port 8123;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        proxy_set_header Host $host;

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

This is the command used to run the container:

usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker create --name='HomeAssistant' --net='proxynet' --privileged=true -e TZ="America/Los_Angeles" -e HOST_OS="Unraid" -p '8123:8123/tcp' --device='/dev/ttyUSB0' 'homeassistant/home-assistant'