Block direct IP access on litespeed?

Hi. I’m on Fozzy shared hosting, and they have some kind of setting that uses real visitors IPs. So I can’t block all IP except сloudflare ones with htaccess… Please help.

If Litespeed supports htaccess, and I believe it does, this is what I use:

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

Just make sure you have the IP Geolocation enabled in your Cloudflare Network settings. It will block any traffic that doesn’t have that header.

But an abuser can set this header for himself, isn’t it? What’s the point of that?

Do whatever works best for you.