Hacker News new | ask | show | jobs
by mdoms 1587 days ago
I'm a little confused about hostname routing. You set up a config file with hostname values like either of the two below:

  ingress:
    - hostname: myapp1.examples.com
      service: http://localhost:8080
    - hostname: myapp2.example.com
      service: http://localhost:8081
    - service: http_status:404

  ingress:
    - service: http://localhost:80
Then later you explicitly route to a subdomain for the simple case (the second one above):

  $ cloudflared tunnel route dns mytunnel test.example.com
Now you're on a subdomain, how would I handle this routing case for the more complex case from above?
1 comments

Hi, I'm the author of the blog post being promoted here.

The `clouflared tunnel route dns` command creates thee DNS record mapping the tunnel to the domain. The tunnels config maps the hostname to the local service, and you can have multiple of those for each service. So for the example above, you would create a DNS record for each domain pointing to the same one tunnel, and that tunnel will route based on the ingress rules.