How do I setup HA remote access on CasaOS using a Cloudflare Tunnel?

I have setup a cheap home server, with OMV and CasaOS. I am using a Cloudflare tunnel to enable remote access to apps on the server. For most services, this works and allows quick and secure access to my resources.

However, when I tried to set it up for HA, with the public hostname “homeassistant.[mydomain].net” and a service URL of “192.168.1.162:8123”, I get a 400 Bad Request error upon going to the hostname domain.

I am aware of a Cloudflare Tunnel addon for HA, but as I am running it as a Docker container in casa, addons aren’t available.

I also tried Nginx PM, but this produced the same result. I also tried to install HA supervised along side OMV and Casa, but for some reason this removed OMV.

Ideally, I would get an Pi 4 or something as a dedicated machine for HAOS, but to be honest this is just a hobby project, so I’m running to a pretty much non-existent budget, and I don’t really feel like running yet another machine 24/7.

So, is there any way of getting this working, or will I just have to use port forwarding and a damn strong password?

You might need to set the use_x_forwarded_for and trusted proxies: