Cloudflared tunnel configuration to specific server URL

Hello Team Cloudflared

Thanks for building this great product! I have one question:

Is there any option to define a public hostname pointing to a specific server url

E.g.

myapp.mydomain.com

to


mylinux.machine.local:8080/myapp

OR

myapp.mydomain.com/myapp

to

mylinux.machine.local:8080/myapp

Thanks!

I’m confused what you are asking about? When you define a public hostname you put in the configuration of where to send the traffic to and you can chose any of those options.

Hi @DarthCloud did you ever end up finding a way to do this?

When ever I put a path into the service URL it just says that it is invalid :frowning:

For those that may come later, like I did, searching for a way to do this. After reading quite a bit and following other links, I think I got there in the end.

Basically in summary, for anyone or my future self:

  • Create the tunnel & link for your server; for me I used Cloudflared on Proxmox LXC via Proxmox VE Helper-Scripts. Once the tunnel is authenticated/linked to your server…
  • Go into your Cloudflare dashboard and select the domain name. Go to rules on the left. Select Transform Rules & Create rule.
  • Create the rewrite rule with the custom filter expression, for me I wanted anything that said something.mydomain.com to then direct to a specific local website path. So added the field ‘hostname’, ‘equals’, value; something.mydomain.com. Then… path rewrite to, static /my/path. Deploy.
  • Now. Go back into Access → Zero Trust. Networks → Tunnels. Select the tunnel & press edit.
  • Create a public hostname, with the same something.mydomain.com and your local web url ie. 192.168.1.20:3090 . However, do not put the path at the end (/my/path) as the rule above will take care of that.

Hopefully this makes sense and helps someone