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

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

ingress:
  - hostname: subdomain1.mydomain.com
    service: http://127.0.0.1:8083
  - hostname: subdomain2.mydomain.com
    service: http://127.0.0.1:8094
  - 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> subdomain2.mydomain.com

1 Like