Problems Using htaccess To Prevent Cloudflare Bypass When Using Cache Bypass Page Rules

This needs to be done at a firewall level, either on your server, or upstream.

What I did for .htaccess was check for the Country header, but make sure Geolocation is enabled in the Cloudflare dashboard:

RewriteEngine On 
RewriteCond %{HTTP:CF-IPCountry} ^$
RewriteRule ^ - [F,L]
2 Likes