CloudFlare firewall rules not unlock country as per rule when use expression builder

I have created a Cloudflare firewall rule to block the “mod_pagespeed” admin area to all countries except my country by using the following filter. But this filter not working as I expected. It blocked my country too.

(http.request.uri.path contains “/ngx_pagespeed_statistics”) or (http.request.uri.path contains “/ngx_pagespeed_global_statistics”) or (http.request.uri.path contains “/ngx_pagespeed_message”) or (http.request.uri.path contains “/pagespeed_admin/”) or (http.request.uri.path contains “/pagespeed_global_admin/” and ip.geoip.country ne “LK”)

But if I change that filter like follows via the Expression editor it works as I expected.

((http.request.uri.path contains “/ngx_pagespeed_statistics”) or (http.request.uri.path contains “/ngx_pagespeed_global_statistics”) or (http.request.uri.path contains “/ngx_pagespeed_message”) or (http.request.uri.path contains “/pagespeed_admin/”) or (http.request.uri.path contains “/pagespeed_global_admin/”)) and ip.geoip.country ne “LK”

How do I do create the above corrected filter using “Expression Builder”.

Expression Builder doesn’t do a good job of bracketing conditions. When your requirements get more complicated, you have to resort to using the Expression Editor, as you’ve successfully done.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.