Cant get Home Assistant to work with SWAG

I wanted to start off by saying thank you for your hardwork and making using a reverse proxy easy to use,

I am successfully using swag for a lot of different services in my home so i know swag is working great with https

I can successfully access my Home-Assistant container from anywhere inside and outside my network with

(i added the W to either end of the link because for some reason i can put more than 2 links in a post)


I am trying to get home assistant to work with swag reverse proxy https exactly the same way as my 10 other apps that i have but it is failing with

502 Bad Gateway

After searching the Home Assistant forums there seem to be some extra steps that need to be added to the config file but i am not 100% sure what to do

Here are the 2 leading guides that explain how to use Lets Encrypt with HA from scratch

Hopefully there is something that is missing in the default SWAG container homeassistant.subdomain.conf file that needs to be added to get this to work

Here is my setup

Docker-Compose File

image: homeassistant/home-assistant:stable
container_name: home-assistant
   - TZ=America/New_York
  - /etc/localtime:/etc/localtime:ro
  - /media/username/nfsset/containers/home-assistant/config:/config
  - 8123:8123
#network_mode: host
restart: unless-stopped

Completely Default homeassistant.subdomain.conf

# 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 homeassistant.*;

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;

# enable for Authelia
#include /config/nginx/authelia-server.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 /ldaplogin;

    # enable for Authelia
    #include /config/nginx/authelia-location.conf;

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



Sorry for the lengthy post but i tried to be as complete as possible

This was solved on discord by changing the $upstream_app var to home-assistant to match the container name


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.