Page 1 of 1

Configure CSF to use HTTP_CF_IPCOUNTRY for CC_ALLOW_FILTER

Posted: 18 Nov 2023, 20:31
by GoWilkes
I've always used CC_ALLOW_FILTER to block non-US IPs, but I recently began using Cloudflare and now all connections come from a Cloudflare IP! My server load has skyrocketed, so I don't think that CSF is able to block non-US IPs anymore.

I blocked them in Apache configuration, but I think that runs after CSF, too, so I'm still getting the Apache connection for each request. And I'm talking about HUNDREDS per second!

Cloudflare sends this environment variable for the country code:

HTTP_CF_IPCOUNTRY

Is there a way that I can modify CSF to use this variable to check for the country code, instead of whatever build-in variable it's using?