Setup home assistant with Let's encrypt on synology with your own domain and reverse proxy

Hi guys

I’ve just setup my home assistant on my own domain through my synology servers Let’s encrypt certificate, and i thought i would share the basics.

If you have a synology server with a public domain with a Let’s Encrypt certificate as i do, and you want to use the same certificate for your home assistant server, this is how you do it.

i’m assuming your home assistant server on the same network as your synology, and you already have made a port forward rule for port 443 and/or 80 to your synology for your normal webpage to show.

example:
synology server ip: 192.168.1.10
domain name: https://mytestpage.com
home assistant server: 192.168.1.11
home assistant port: 8123

the goal here is to make home assistant work from:

https://mytestpage.com:8123

First you make a new port forward rule in your router configuration that points all traffic from the internet on port 8123 to your synology server on the same port.

internet traffic on port 8123 -> 192.168.1.10:8123

logon to your synology server and open your control panel. open Login-portal / Advanced and click on reverse proxy.

make a new and enter:

name: anythingyouwant
Source:
protocol: HTTPS
host: mytestpage.com
port: 8321
check HSTS

Destination:
protocol: HTTP
host: 192.168.1.11
port: 8123

click custom header and create. Choose websocket and save

open your home assistant configuration.yaml file and insert the following:

 http:
     server_port: 8123
     use_x_forwarded_for: true
     cors_allowed_origins: https://mytestpage.com
     trusted_proxies:
     - 192.168.1.0/24

save it and restart your home assistant. you should now be able to access your home assistant on

https://mytestpage.com:8123

I hope this might help and that i did not miss or forget something. have fun.