Expand my Community achievements bar.

Geo IP based redirection in Apache 2.4 with a dispatcher

Avatar

Level 1

Hello,

We have a requirement to block users from certain countries  from accessing certain pages,please help us if anyone have implemented this solution already with AEM and dispatcher with Apache. We have already tried having an .htaccess with all possible IP for a country but is not a feasible one since we have to update those country IP list frequently also tried MaxDB but failing at the step of including MaxDB module at Apache.

Please let us know if any alternatives or detailed step available to acheive above mentioned requirement, thanks for your help in advance.

Happy New  Year 2018

Thanks

SV

10 Replies

Avatar

Level 1

Hi edubey,

Thanks for the suggestion,we tried executing the commands but unfortunately mod_geoip package is not present in repository.

# sudo yum install GeoIP GeoIP-devel zlib-devel mod_geoip

Loaded plugins: amazon-id, rhui-lb, search-disabled-repos

cloudpassage                                                                                                           |  951 B  00:00:00

rhui-REGION-client-config-server-7                                                                                     | 2.9 kB  00:00:00

rhui-REGION-rhel-server-releases                                                                                       | 3.5 kB  00:00:00

rhui-REGION-rhel-server-rh-common                                                                                      | 3.8 kB  00:00:00

No package GeoIP-devel available.

No package mod_geoip available.

Resolving Dependencies

Thanks

SV

Avatar

Level 10

I am not sure what could be causing installation issue via yum but give it a try to download the package and install it manually from

https://github.com/maxmind/geoip-api-mod_geoip2/releases

Avatar

Level 3

Hi,

Provided link is not working we are getting 404 error while following the steps  mentioned in URL .

URL Link:

http://aempodcast.com/2015/infrastucture/configure-aem-dispa…

Error :

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

--2019-01-21 18:37:38--  http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

Resolving geolite.maxmind.com (geolite.maxmind.com)... 104.16.37.47, 104.16.38.47, 2606:4700::6810:262f, ...

Connecting to geolite.maxmind.com (geolite.maxmind.com)|104.16.37.47|:80... connected.

HTTP request sent, awaiting response... 404 Not Found

2019-01-21 18:37:38 ERROR 404: Not Found.

Avatar

Level 10

Try this, it has both csv and binary formats ---  https://dev.maxmind.com/geoip/geoip2/geolite2/

Off the topic, I'm curious to understand the reason for not handling this use case before even the request reaches apache (LB or CDN)? Are there any constraints that you must do it on apache?

Avatar

Level 3

Hi,

But GeoLite Legacy databases were discontinued on January 2, 2019. How can i use this one in Prod environment.

Thanks,

Nagesh

Avatar

Level 3

Hi,

Can i implement them on Redhat due to Libmaxminddb supports only Ubuntu. If yes please share me the steps how to implement it.

Avatar

Level 10

check  -GitHub - maxmind/geoipupdate: GeoIP update client code

Installing on RedHat or CentOS via the rpm

You can also use the tarball.

Download the appropriate .rpm for your system.

Run rpm -i path/to/geoipupdate_4.0.0_linux_amd64.rpm (replacing the version number and architecture as necessary). You will need to be root. This will install geoipupdate to /usr/bin/geoipupdate.

geoipupdate looks for the config file /etc/GeoIP.conf by default.

Avatar

Employee Advisor

Just to have it mentioned here: This question is not specific to AEM or AEM dispatcher, but rather a generic question which relates of Apache httpd.