Configure CSF to use HTTP_CF_IPCOUNTRY for CC_ALLOW_FILTER

Post Reply
GoWilkes
Junior Member
Posts: 29
Joined: 15 Nov 2010, 20:57

Configure CSF to use HTTP_CF_IPCOUNTRY for CC_ALLOW_FILTER

Post 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?
Post Reply