cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

💡How do we setup with the same domain name, a second tunnel with cloudflared for another HA instance running at another location

Open LEMD49 opened this issue 11 months ago • 3 comments

Describe the feature you'd like Given a working cloudflared HA setup at location 1, using domain and subdomain "loc1", how to run a second / third / fourth / Home Assistant instance on a server located at another location, changing only subdomain.

The idea would be: aa.mydomain.com:8123 signs in HA at location aa bb.mydomain.com:8123 signs in HA at location bb

Describe alternatives you've considered Having attempted to install and configure add-on cloudflare and setup bb.domain.com, I received a fatal error

Additional context Add any other context or screenshots about the feature request here.

LEMD49 avatar Jan 14 '25 12:01 LEMD49

Hi, For each of your subdomains, you'll need to set up a separate tunnel, as they require individual cloudflared instances. If you can get the error message, please share the details with us so we can try to provide more assistance. Keep in mind that the Cloudflare add-on for HomeAssistant is a community-developed integration, not officially supported by our team, but we're happy to help troubleshoot any issues.

jcsf avatar Jan 27 '25 11:01 jcsf

you'll need to set up a separate tunnel, as they require individual cloudflared instances.

@jcsf Are you sure about this? The docs here states:

Within the same tunnel, you can run as many 'cloudflared' processes (connectors) as needed.

To achieve what the OP is asking, can we use one tunnel and connect multiple cloudflared instances to it (with multiple CNAME records), or does it need to be two separate tunnels as you suggested? Thanks.

tjb36 avatar Mar 24 '25 21:03 tjb36

You can have multiple CNAME records for a single tunnel instance. However, from what I understand, @LEMD49 is attempting to run the connectors in different locations. This suggests that the Home Assistant instances likely have different IP addresses and are not accessible from both networks. As a result, each location would require a separate tunnel. If a single tunnel is used with multiple replicas, requests for instance A might be routed to location B, causing errors, and vice versa for instance B.

This is actually a straightforward setup: simply configure a separate tunnel for each location and associate it with the appropriate URL to be exposed. I'm not sure how the Home Assistant add-on works, but this process is relatively simple and can easily be done via the Cloudflare Dashboard. Just create the tunnel, add the necessary route, and retrieve the token to run it in the desired location.

jcsf avatar Mar 25 '25 00:03 jcsf