Cloudflared - adding a second tunnel - how to point at multiple origins

Hello - I have set up one tunnel and it is working really well.

I have created a second subdomain and would like to set up a second tunnel

ie first tunnel is subdomain1 . mydomain . com,
second tunnel is subdomain2 . mydomain . com

I have configured it as a tunnel but when I try to run the “cloudflared.exe service install …” on my Windows device on the local network I get this error:

“Installing cloudflared Windows service
cloudflared service is already installed at Cloudflared; if you are running a cloudflared tunnel, you can point it to multiple origins…”

Any advice on how I do this? I can’t find a solution online. Thanks

As it’s saying, use your single tunnel to serve both domains if both of the origins/web servers are on the same machine.

If you’re using Dashboard managed tunnels (modifying settings in the Zero Trust dashboard), it’s as simple as adding a second Public Hostname to your existing tunnel, just specify the new subdomain and the different service, and done.

If you’re managing the configuration locally, use ingress rules: Ingress rules · Cloudflare Zero Trust docs
and perhaps consider switching to dashboard managed tunnels at some point, they’re a lot less manual to work with and easier overall.

ex. config:

tunnel: 6ff42ae2-765d-4adf-8112-31c55c1551ef
credentials-file: /root/.cloudflared/6ff42ae2-765d-4adf-8112-31c55c1551ef.json

  - hostname:
  - hostname:
  - service: http_status:404

Then just create the necessary DNS Records after. The tunnel can do this for you,
cloudflared tunnel route dns <tunnel name/id>

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.