This can be a little tricky to get right, but here's one config that works (at least now, 10/24).
This Gist assumes you're using something like a network gateway device rather than attempting to tunnel directly to HAOS or the VM running it.
Firstly, set up the tunnel to that device and verify that the tunnel is operational.
Next, two modifications to the configuration.yaml are needed:
- Set your gateway as a trusted_proxy (using its LAN IP)
- Set the base URL
Say I want to provision an access point to my Home Assistant and I have a domain called danielshome.com
Step 1:
I might set up a mini PC as my network gateway. So I'll open up a tunnel to danielshome.com and then I'll set up an Access rule so that only I (or authenticated people) can access it.
Step 2:
Let's say my Home Assistant is running on 192.0.0.1:8123, I'll then create a hostname record at (say):
homeassistant.danielshome.com and have the local connection (service) setting as:
192.0.0.1:8123
Step 3:
If my network gateway (for the sake of this example) has a fixed local IP of 192.0.0.2, I would add
cors_allowed_origins:
- https://homeassistant.danielshome.com
And I would add the gateway as a trusted proxy:
use_x_forwarded_for: true
trusted_proxies:
- 192.0.0.2