© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2y ago•
43 replies
nickchomey

Multiple hostnames/domains with locally managed tunnels?

I'd like to locally manage tunnels programmatically via the CLI. I want it to be able to route requests from multiple domains and subdomains to different sites that are behind a Traefik router.

When I
cloudflared tunnel login
cloudflared tunnel login
, it asks me to select a zone/domain. Let's say that I select
nick.com
nick.com


I can then create a tunnel with
cloudflared tunnel create nick
cloudflared tunnel create nick
If i then run
cloudflared tunnel list
cloudflared tunnel list
, it shows various tunnels that I've created previously - both via the dashboard and CLI.

If I create a route
cloudflared tunnel route dns nick 1.nick.com
cloudflared tunnel route dns nick 1.nick.com
, i get the response
Added CNAME 1.nick.com which will route to this tunnel tunnelID...
Added CNAME 1.nick.com which will route to this tunnel tunnelID...
.

If I create a route
cloudflared tunnel route dns nick 2
cloudflared tunnel route dns nick 2
, i get the response
Added CNAME 2.nick.com which will route to this tunnel tunnelID...
Added CNAME 2.nick.com which will route to this tunnel tunnelID...
. So, the tunnel seems to very much be tied to a specific domain (
nick.com
nick.com
).

If I then run
cloudflared tunnel route dns othertunnel 1.othertunnel.com
cloudflared tunnel route dns othertunnel 1.othertunnel.com
, i get the response
Added CNAME 1.othertunnel.nick.com which will route to this tunnel tunnelID...
Added CNAME 1.othertunnel.nick.com which will route to this tunnel tunnelID...
.

So, it seems like when I am logged in via cloudflared CLI, even though you can see your account's different tunnels, you can only actually use one of them at a time. Moreover, even if you try to create a route on a different tunnel, it'll get created on the one you are currently logged-in to. Is this accurate?

As far as I'm aware, if we use remote-managed tunnels, we can create routes with any of our domains. So, how are we supposed to do something similar with locally managed tunnels? I'm trying to make it all programmatic, so that I can integrate it into the fantastic open-source DDEV (https://ddev.com/) development environment, which is a wrapper around docker for developing with pretty much any PHP CMS or Framework I really don't want people to have to keep going to their dashboard to manually change things - it should just be a CLI command that magically does all the tunnel routing.

Any suggestions? Thanks!
DDEV
DDEV
Local development environments in seconds. Customize, share, and extend with ease.
DDEV
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Locally managed CF tunnels and DNS
Cloudflare DevelopersCDCloudflare Developers / general-help
17mo ago
Container workflow for Cloudflare Locally-Managed Tunnels
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
Access tunnels & custom hostnames
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
multiple tunnels, multiple sub domains, wazuh and cloudflare
Cloudflare DevelopersCDCloudflare Developers / general-help
3y ago