I want to be able to access my HA from outside my house securely with my own custom domain. I am able to access it insecurely by using http://homeassistant.mycustomdomain.com:8123 but I really don’t want it to be insecure.
I’ve seen countless tutorials and threads on using duckDNS but I don’t get how to apply it to my own domain. I can change DNS records and port forward but I don’t get how to put it all together.
Where yourHomeAssisistantLocalIPAddress is the local IP address of your homeassistant (192.168.1.XXX) . Forward your external router ports 80 and 443 to this IP. Caddy should automatically renew the encryption certificate and forward requests from that subdomain to your homeassistant. I think that’s it, took a little trial and error to get it all working. Others may have better solutions, try what works for you. The header part is optional, but it apparently makes it more secure. You can add more entries for different subdomains if you run other services (like vaultwarden, emby, etc)
you will need to add this repository into your Supervisor->Addon Store->Three Dot Menu->Repositories
Thanks for this. I’ve installed caddy, created the folders and then created the file, Caddyfile (no extension). I’ve entered my email, and replace mycustomdomain with my domain and set the IP.
Looks like you did everything correct. Possibly your ISP blocks port 80? If that is true, you may need to do a DNS challenge, which is a pain. I would check on the caddy site for help Caddy Community
It should not matter, but you should not have port 8123 forwarded (the whole point is to just use 80 and 443, and not expose 8123). Caddy will automatically forward 80 to 443 as well.
Also try http:// your to your IP. Caddy should autoforward, this will at least tell you that caddy is working.
Maybe post your caddy file. To remove variables, you can also remove the (header) section and the import header line.
Also, try the suggestion above. I do not have the http:// and it works. I don’t think you need to, but you may need to set the external IP address in your homeassistant setup. Configuration->General
So I left it for a bit. Didn’t do anything, no restarts, no config changes, nothing. But suddenly it’s working. Thank you for the help. It’s much appreciated. Also, thanks @koying for further support.