New Add-On: Cloudflared

Are there instructions to set this up with Home Assistant Core? HA Core can’t use an add-on repository, installation has to be manual. I poked around the two repos and wiki but couldn’t see anything.

In case anyone else wants to use cloudflared with home assistant core, once you get your tunnels working adding the block below to your configuration.yaml works. It’s basically telling Home Assistant to accept requests that are proxied via your local machine.

http:
  server_port: 8123
  ip_ban_enabled: true
  login_attempts_threshold: 5
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - ::1

I have now setup the HA Cloudflare Integration and created an automation to update the DDNS record whenever my external IP address changes. Thank you!

I have also successfully added an additional host to connect to my CCTV system. Even if I watch the cameras briefly when remote I would like to disable caching to avoid being banned. Can this be done per DNS record or tunnel, and if so where?

Hi, I don’t know why but regularly I’m not able to access my homeassistant page from outside my network. Locally it always works to connect to my homeassistant. Maybe somebody can help me with those logs if there is something wrong? Thanks in advance already!

2023-01-28T11:26:39Z ERR Failed to serve quic connection error="timeout: no recent network activity" connIndex=0 ip=198.41.192.107
2023-01-28T11:26:39Z ERR Serve tunnel error error="timeout: no recent network activity" connIndex=0 ip=198.41.192.107
2023-01-28T11:26:39Z INF Retrying connection in up to 1s connIndex=0 ip=198.41.192.107
2023-01-28T11:26:39Z ERR Connection terminated error="timeout: no recent network activity" connIndex=2
2023-01-28T11:26:39Z ERR Connection terminated error="timeout: no recent network activity" connIndex=1
2023-01-28T11:26:40Z ERR Connection terminated error="timeout: no recent network activity" connIndex=0
2023-01-28T11:26:45Z INF Connection 19e7f259-4346-46d4-876f-583d59a5468b registered with protocol: quic connIndex=1 ip=198.41.200.113 location=VIE
2023-01-28T11:26:45Z INF Connection 07683c83-6198-45e7-8fe3-e04cdbf169dd registered with protocol: quic connIndex=0 ip=198.41.192.167 location=PRG
2023-01-28T11:26:45Z INF Connection b6b309ef-1b18-41f1-bbf9-a5e347b045d7 registered with protocol: quic connIndex=3 ip=198.41.192.67 location=PRG
2023-01-28T11:26:45Z INF Connection 6e3b110b-b623-4f57-99f2-98788253f4c5 registered with protocol: quic connIndex=2 ip=198.41.200.73 location=VIE

My config:

http:
  server_port: 8443
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24
  ip_ban_enabled: true

The Cloudflare TOS makes it clear that unless you have a subscription to Cloudflare, the tunnel should only be used for HTML or other functional equivalents. That said:

Use of the Services for serving video or a disproportionate percentage of pictures, audio files, or other non-HTML content is prohibited, unless purchased separately as part of a Paid Service or expressly allowed under our Supplemental Terms for a specific Service. (emphasis mine)

I get the sense that there is some sort of threshold that once you cross will trigger an email or a disablement of services.

I’ve been running Cloudflared tunnel for about 2 weeks. I have to say, I’m not impressed. My tunnel randomly disconnects and often cannot connect to it when I’m away from home. I know that there was an outage a few days ago where tunnels were affected but I haven’t been able to get it to consistently work before or after the incident.

I think this is an interesting add-on and will look to see if it improves over time.

Yes, I will use this option carefully. This is also something to think about for people having CCTV showing within HA.

For me I would only use this option when I get an event triggered from any of my cameras. It’s nice to quickly be able to verify the event and not having to enable VPN first.

Still, is there anything regarding cache or alike that I may disable within the Cloudflare service?

Hi! Please write how you added additional host?

I thought I would share my alternate experience. I have been using this Addon since it was first created, and I have never once had an outage, the tunnel stays up the entire time, and I have never once not been able to access HA. I use Google OAUTH, with 2FA, and the WARP client as part of the Zero Trust for Teams setup, and it all works perfectly. It really is simple. I have multiple other hosts using the same tunnel, all via this add-on. Thank you to the developer. Great job.

In HA go to Configuration and Add-ons. Go to Cloudflared add-on and Configuration. In the top-most box “Additional Hosts” add your details.

- hostname: <your_host>.<your_domain>.<com>
  service: http://<your_ip_address>:<your_port>

Replace the entries within brackets with your own details.

Hey Tobias,

is there a way I can use one domain with cloudflare for two Home Assistant instances in different networks?
Like ha1.mydomain.com and ha2.mydomain.com.
If I follow the guide, my domain is always connected to only one instance.

Thanks in advance.

— Update —
Solutions seems to be: just enter the new subdomain in cloudflared configuration. The rest will be done in background

Have you secured your HA instance in any additional way using Cloudflare, than just the tunnel?

Hello, thanks for this add-on just trying to get it all installed and stuck on this
image

I have setup the cloudfare side and created the token and added it into the integration but the next screen shows the above
I’m stuck now, any help would be appreciated, thanks

Sorry I dont think I set the A record in my domain account, I think its resolved now

But waiting to authorise my tunnel, selected the wrong domain name …Duh should be ok now, thanks

Just use the “proper” cloudflared tunnel right from cloudflare in a docker container works flawlessly for me.

1 Like

hey!
I got it working just fine, but the additional hosts don’t work for me.

let’s say my domain name is www.example.com
In Cloudflared configuration I set

- hostname: router.example.com
  service: http://192.168.0.1

Then when I go to the URL I get a This site can’t be reached error.

is there something else to do to make this work?

Thanks!

Hi Tobias,
thanks for the addon. I am sure it does a great job for many but I followed your installation instructions step by step, several times, and every single time after starting the addon Home Assistant basically locks up and does not react to anything anymore. It takes hours to get back to the addon settings and stop or uninstall it.
Not sure what is causing this. But maybe interesting for you to know.

Had to uninstall it again.

Cheers,

Merc

Hi, all

Apologies is this has been asked, but in Cloudflare, under SSL/TLS > Overview, should it be left in Flexible or is it better to change to Full?

Thanks!

1 Like

Hi! I’m fairly new to HA, i have successfully gotten Cloudflsred setup and working. I am running into an issue with my Wireguard VPN service. I have setup an additional host with vpn.domain.com, pointed it towards the port on HA, and updated the domain on the wireguard vpn. My phone is able to reach out and connect to the vpn, although once connected, my phone will not have access to internet. I did have it setup and working properly using DuckDNS prior without issues, although i’d prefer to use the secured tunnel through my Cloudflare domain.

Can I use same domain on more HomeAssistant servers via CloudFlare?

To have for example first instance on mydomain.com, another on home.mydomain.com, third on office.mydomain.com

Do I have to change anything or just enter the same settings to another instance but new name?

yes. you can.
Just configure the subdomain in the add-on.