Transform rules doesn't work properly

Hi.

I have the following transform rule: (ip.src ne ip1) or (ip.src ne ip2), then rewrite to …

So when I attempt to access the page having ip1, it still redirects me to another page, even though it shouldn’t.

What might be the mistake?

IP 1 matches the second condition (ne ip2). Try linking with and instead.

That logic will match every address, is that what you intended?

I wanted to make it that only specific IPs are allowed to access the page, otherwise they are redirected to another page.

You have confused yourself with the logic, it is a common problem (unrelated to Cloudflare) Use an expression like this, which is much easier to understand:

(not ip.src in {192.0.2.1 192.0.2.2})

Note that on their own, Transform rules will not perform a HTTP Redirect. You can combine a URL Rewrite that appends some string to the path with a Page Rule that targets that special string to perform the Redirect. Otherwise it will serve a different path to the user without the address bar changing to reflect the new URL.

3 Likes