Firewall Rule Matches Question - How to match on a random uuid in a path

Good day all,

How would I create a firewall rule that is able to take action against a path that will always contain a random element in it?

As an example if I wanted to block PUT requests to a path where a random uuid would be present /sub/5b857e11-e563-4983-8e00-31a8b82d4de5/account/update/phonenumber

I found matches in the Cloudflare documentation however I am not familaire enough with regex to understand how I would account for a value in the path that I would not know ahead of time.

I was able to find a uuid regex example online so I was curious if this would work?

(http.request.uri.path matches "^/sub/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/account/update/phonenumber$")

Thank you.

Your regex is correct for what you intend to accomplish. Create a Firewall Rule, click on “Edit Expression” link, paste it, then open the Expression Builder and add the other condition,

AND Request Method equals PUT.

1 Like

Thank you fro the confirmation @cbrandt I really appreciate it.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.