ESPHome & Cloudflare Tunnel -- Websocket Issue

I’m having trouble getting ESPHome to work when used through my CloudFlare tunnel.

I have a basic CloudFlare Tunnel setup and working. I can access the HA instance from my home computer through the tunnel without any issues (other than the one here), see my DSM linked security cameras, turn lights on, etc, with no issues. This also all works remotely through the HA app on my phone when away from the house. I’ve also setup an additional “host” in the configuration that allows me to access my Synology and that’s working fine as well.

What does not work is several functions under the ESPHome area of HA.

What I access the ESPHome section via my local address (http://homeassistant.local:8123) I can click on one of my ESP devices “Logs” button and get a stream of logs without issue. I can also install wirelessly and “Verify” the configuration.

However, when accessed over my Cloudflare tunnel connection (, these displays show nothing.

As an example: in both circumstances, when trying to run the “Validate” command, the webapp is opening a WS (or WSS):


In the local tab, this will show a checkmark and stream a bunch of data in to the UI (which can also be seen in the devtools). In the tunnel tab, however, nothing ever comes back from the websocket – like it’s never fully established.

I’ve checked my Cloudflared logs and don’t see anything obviously revealing.

My cloudflare tunnel has only the two forwarders setup: -> one one for the Synology (that forwards to unverified https instead). Maybe the forwarding from tunnel → HA needs to have HA be on HTTPS instead of HTTP so some part of the websocket chain isn’t broken? Swing in the dark.

I’ve searched around the forums a bit and seen some other folks successfully have this setup and working, so I believe it’s possible, I’ve just missed a switch/toggle/config somewhere.


I had problems forwarding to IP address. For that reason, I always use homeassistant

Was worth a shot! Sadly, didn’t seem to change the behavior (still loads everything but the ESPHome items).

I am using the Cloudflare tunnel in Remote mode, though, as opposed to Local – maybe there is something to that?

Aha! Using the local variant DOES fix the problem. I may dig into the remote vs. local configurations to see if I can suss out what configuration difference makes this work vs. fail.

1 Like