Zero Trust - Paths rather than subdomains

Hello!

I was wondering if it was possible to route based on paths rather than subdomains? For example, I’d like /home to route to port 8080/, and /other to route to to port 8081/.

Yes you can. See Configuration file · Cloudflare Zero Trust docs for how routing in done.

Ah yes, I see the path option. Is this possible within the on the website or would I need to convert to the yaml format?

Yes. When you make a public hostname, it has a path field.

Ah, that.

The issue is, lets say I had a web server, CF also passes the path, so on the webserver it would be looking for /path.

Is there any workaround for this? I guess I could proxy it on my end, but I am wondering if it is possible with CF first.

I am not aware of anyway to. Cloudflared is a simple proxy and doesn’t have rewriting features.

@Cyb3r-Jak3 Well cloudflared (Zero Trust) can’t. But shouldn’t we be able to use the transformation rule from the normal cloudflare dashboard to do that?

I did try to do that and failed though. I could be missing something.
I tried something like this
example.com set up x.x.x.x
example.com/ssh set up to render a ssh terminal from x.x.x.x
created a transformation rule to rewrite and remove the /ssh

Didn’t work.

No because the request will reach the tunnel looking like example.com which will be routed to the first option.

1 Like