CloudFlare tunnels public hostnames path restrictions
Good afternoon
Does anyone know if the paths support some form of regex or something along those lines?
I have two public hostnames that use the same subdomain, but are supposed to go to a different service depending on the path.
The problem is that one has the root path (which comes out as a *), and the other has a sub path (like /public/*).
And now I'm having redirection issues, is there any way to avoid the * also listening in on the public/*?
1 Reply
Support AI
Good afternoon.
According to the documentation, yes, you can use regular expressions for the
path key. As stated in the documentation: "You can also enter regular expressions for the path key." (Source: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/configuration-file/)
Additionally, it's mentioned that "Cloudflare parses the path regex using the Go syntax package." (Source: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/configuration-file/)
To avoid the * also listening in on the /public/*, you can try using a more specific regular expression for the path key. For example, you can use the ^ character to match the start of the path, like this: ^/public/.* (Source: https://pkg.go.dev/regexp/syntax)
Here's an example of how you can define the ingress rules:
This way, the first rule will match only the /public/* path, and the second rule will match only the root path (*).Feedback
Feedback has been submitted! Thank you :)
This is an AI generated response, it may not be 100% accurate. Please validate the output. You can ask followups by replying to this message or mentioning me.