cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

💡When running `cloudflared tunnel route dns tunnel-name tunnel.x.com` use the x.com zone

Open remorses opened this issue 1 year ago • 2 comments

Describe the feature you'd like Currently to create a tunnel you have to run the following commands (dx is already very bad, should be 1 command)

cloudflared tunnel  create tunnel-name
cloudflared tunnel route dns tunnel-name tunnel.example.com
cloudflared tunnel run --url http://localhost:5467  tunnel-name

This won't create a tunnel on tunnel.example.com if for some reason you used the cloudflared on another domain previously (for example x.com), instead it will create one on tunnel.example.com.x.com

Describe alternatives you've considered Use the website with domain example.com if i am trying to create a tunnel there, not tunnel.example.com.x.com

Additional context Maybe you have to run cloudflared tunnel login again? But there is only 1 global cloudflared config at /Users/user/.cloudflared/cert.pem, this doesn't make sense

remorses avatar Jul 17 '24 13:07 remorses

I think i managed to get this working, congrats on making the most user hostile cli i ever used, and i used a lot of clis

  1. Create the tunnel on the cloudflare website, the cli is useless, it will use whatever domain you selected the first time you logged in
  2. Now you have to download another tunnel token even if you already are logged in, because why not
  3. To do this run cloudflared tunnel token --cred-file .cloudflared/tunnel.json tunnel-name
  4. Now create a file .cloudflared/config.yml and add the contents
tunnel: tunnel-name
credentials-file: ./.cloudflared/tunnel.json
  1. Now you can finally run the tunnel with cloudflared tunnel --config ./.cloudflared/config.yml run --url http://localhost:8040 tunnel-name. Notice how you have to pass the config manually and not after run because otherwise it breaks. Cloudflared only searches ~/.cloudflared because everyone knows non reproducible user based global configs are the best

remorses avatar Jul 17 '24 14:07 remorses

Apparently they still haven't fully migrated from the legacy zone specific tunnels. This problem has existed for at least three years:

Obviously using the GUI is not a solution, it's just a workaround. I'm tired of clicking around on the web page to add/remove public hostnames.

ZnqbuZ avatar Feb 24 '25 13:02 ZnqbuZ