Forum Moderators: phranque

Message Too Old, No Replies

GeoIP - a third case

         

dstiles

2:35 pm on Aug 1, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm trying to add a third case for MaxMind's GeoIP. I can define BlockCountry and AllowCountry but I would like to add WatchCountry for those whose behaviour may be better or worse that I expect.

The Allow and Block versions work well but Watch never fires - I have tracers in the logs to check. Does anyone know why, please?
<IfModule mod_maxminddb.c>
MaxMindDBEnable On
MaxMindDBFile DB /usr/share/GeoIP/GeoLite2-Country.mmdb
MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code
<directory "/srv">
SetEnvIf MM_COUNTRY_CODE ^(BY|CN|HK|ID|IR|KP|RU|SD|SY|TH) BlockCountry=$0
SetEnvIf MM_COUNTRY_CODE ^(BD|BR|NG|RO|TW|UA|VN) WatchCountry=$0
SetEnvIf MM_COUNTRY_CODE ^(GB) AllowCountry=$0
Require env BlockCountry denied
</directory>
</IfModule>

lucy24

5:04 pm on Aug 1, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't, of course, know anything about GeoIP, but this sounds like an issue of mod_setenvif being cantankerous.
The Allow and Block versions work well but Watch never fires
Just to make sure I'm understanding: the BlockCountry and AllowCountry environmental variables are set when you expect them to be, but WatchCountry never is, even when the visitor is clearly from Vietnam or Ukraine or whatnot?

Since WatchCountry isn't (yet) being used for anything that immediately affects access, you might test it by adding something to the list like GB or US that you know is among regular visitors. Or, for that matter, put any country code into two directives--Watch and either Block or Allow--and see if both environmental variables are getting set.

dstiles

8:38 am on Aug 2, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



And once again, Lucy to the rescue! I think I'm losing it. :(

The env var IS being set but I never thought to check the error log, where that is evident. Turns out I forgot to copy the flag into the monitor log. I've been looking at this for months and never found that. Thanks again, Lucy!