Here is my basic Home Assistant and home network configuration. I am currently running HA 2022.3.8 on Home Assistant OS 7.6. Hope this helps you and anyone else having similar issues.
configuration.yaml:
In configuration.yaml, you need to configure http to enable SSL, NGINX proxy routing, and trusted proxies. In my example, 10.10.70.60 is my Home Assistant internal IP address. Change your IP address accordingly. 172.16.0.0/12 is Docker’s container network subnet. 127.0.0.1 is Home Assistant’s loopback network interface.
letsencrypt configuration:
In order to use NGINX reverse proxy on port 80 to access your HA instance, you must acquire Letsencrypt certs using DNS challenge instead of HTTP challenge. Change the Network port to something besides port 80. I chose 8088 at random. It really doesn’t matter since I won’t be using the HTTP challenge anyway.
nginx configuration:
I override port 443 to 18123. You can use whatever port you want so long as your firewall reflects it in port forwarding. Using a port other than 443 may help with any firewall issues since some ISPs do not allow you to connect to port 443. Enable port 80 on NGNIX to allow you to connect to Home Assistant using the Home Assistant’s internal ip address. Example: http://10.10.70.60:8123
pfsense firewall NAT routing:
Nothing special here. Just port forwarding network ports so my phone or other device from outside the home network can connect with Home Assistant.
pfsense DNS Resolver Host Override:
Optional but handy: I use DNS host override to direct internal network devices (home computer, phone while on your home network etc.) towards the Home Assistant internal IP address. The benefit of this is two-fold. It avoids hair-pinning your home network routing from external WAN to internal LAN, and it allows you to use one domain name for both, internal and external networks. In order for this to work, my computer or phone must point their DNS settings to use pfSense’s DNS resolver. Using Google’s DNS servers (8.8.8.8, 8.8.4.4) or any other third party DNS service will not work.
If all goes well, you should be able to pull up Home Assistant using your domain name or by IP address.
Over http:
Notice I’m on port 8123 when connecting to the IP address directly without https.
Over https:
And now connecting to Home Assistant using my domain name over HTTPS. Notice I am connected on port 18123.
Mobile Home Assistant app:
If your setup is implemented correctly, internal and external connections over the same domain will act transparently. You won’t need to use the internal IP address under ‘Internal Connection URL’ although you can if you are unable to implement DNS host override.