Remote access through Cloudflare Tunnel

Issue with Accessing Home Assistant via Cloudflare Tunnel

Hello everyone,

I recently acquired a domain that I’ve configured in Cloudflare to migrate away from DuckDNS. I’ve ran through several guides, but it just doesn’t seem to work properly. It seems to work perfectly fine from my home network, but when switching to VPN or mobile network I get an “Unable to reach” error message.

Setup:

  • Host machine: NUC with Home Assistant OS
  • IP/port: 192.168.0.157:9999

Tunnel:

  • Status: HEALTHY

Cloudflared:

  • Only Cloudflare Tunnel Token is set
  • Log looks like in the guides I’ve followed, no error messages

Current status:

  • Home assistant accessible through ha..com when at home network
  • Home assistant accessible through homeassistant:9999 when at home network
  • Home assistant not accessible when on mobile, VPN or outside my home

Configuration.yaml:

http:
  server_port: 9999
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

As far as I can see, there’s nothing special with my setup, and I’ve followed the different guides very carefully. What am I missing? Why shouldn’t this work remotely?

This is the one I used - https://youtu.be/xXAwT9N-7Hw?si=LQRdWC7-5urgMg-D

My configuration.yaml is the same as yours but does not have the “server_port: 9999” line at all…

Maybe re-review what is done in this video?

That’s the latest guide I used.

The reason I have :9999 in my configuration.yaml is because I have another Home Assistant server running at the moment. I was thinking of setting up a new box, getting that to work first, then turn off the old one. If nothing else works, I could of course try to turn the old one off and change the new one to default port, but it shouldn’t have anything to say really.

May I ask what your System > Network settings look like? Mine is:

  • Host name: homeassistant
  • IPv4: Automatic
    Home Assistant URL:
  • Internet: ha.mydomain.com
  • Local network: Automatic
  • Network adapter: Auto Configure

I have the same except IPv6 turned off which might make zero difference.
Does the other Home Assistant have the same Host name - maybe that would have an effect?

I suspect the error is within Cloudflare and not Home Assistant, after fiddling around it suddenly works on my work laptop outside from home. I went to the Zero Trust settings, WARP and changed from Exclude IP to Include, and that for now seems to have done it. For some reason it still doesn’t work from my mobile with 5G, only Wifi, but I think I’m getting closer. If anyone has any suggestions on Cloudflare settings, I’m all ears!

Update:
Finally it works on all devices, the culprit was indeed the WARP settings. If anyone are interested, I created a new WARP profile where I included all OSs. Why that would work is beyond me, but I’m happy it works.