C Library
PHP Module
Perl Module
Ruby Library
Python Library
.NET Component
Java Component
Apache Module
Nginx Module
Node.js Module
HTTP Module
Go Package
D Library
Lua Package
OpenResty Package
Splunk Add-on
Erlang Module
Haskell Package
Kotlin Module
Scala Library
Apache Kafka Transform
Deno Module
R Package
IP2Proxy Apache Module
This Apache module support all IP2Proxy™ BIN database products to query proxy IP address and its country, region, city, ISP name, domain name, usage type, ASN, last seen in days, threats and proxy type. The proxy type detected includes VPN anonymizer, open proxies, web proxies, Tor exits, data center & web hosting range (DCH), search engine robots (SES) and residential proxy (RES). It requires IP2Proxy C Library.
Developers can download sample databases to evaluate the Apache module's functionality.
Installation
Unix/Linux
- Create a new folder called ip2proxy.
- Download IP2Proxy C library from here into the ip2proxy folder.
- Decompress C library.
unzip master.zip
- Get into working directory.
cd ip2proxy-c-master
- Start compilation.
autoreconf -i -v --force ./configure make make install
- Download and decompress Apache module into the ip2proxy folder.
- Get into working directory.
cd ip2proxy-apache-master
- Start compilation.
apxs2 -i -a -L /usr/local/lib/ -I ../ip2proxy-c-master/libIP2Proxy/ -l IP2Proxy -c mod_ip2proxy.c ln -s /usr/local/lib/libIP2Proxy.so.1 /usr/lib/libIP2Proxy.so.1
-
Add following lines into /etc/apache2/apache2.conf
<IfModule mod_ip2proxy.c> IP2ProxyEnable <On|Off> # ENV will set server variables # NOTES will set apache notes # ALL will set both IP2ProxySetmode <ALL|ENV|NOTES> IP2ProxyDBFile <PATH_TO_IP2PROXY_BINARY_DATABASE> IP2ProxyDetectProxy <On|Off> </IfModule>
Windows
- Create a new folder called ip2proxy.
- Download IP2Proxy C library from here into the ip2proxy folder.
- Decompress C library using 7-zip or other compression tools.
- Get into working directory.
cd ip2proxy-c-master
- Start compilation.
nmake /f Makefile.win
- Download and decompress Apache module into the ip2proxy folder.
- Navigate to ip2proxy-apache-master folder.
- Edit Makefile.win to change the path for C library.
IP2PROXY_CSRC_PATH = C:/ip2proxy/ip2proxy-c-master/libIP2Proxy
IP2PROXY_CLIB_PATH = C:/ip2proxy/ip2proxy-c-master/libIP2Proxy
APACHE_INSTALL_PATH = "C:/Program Files/Apache Software Foundation/Apachex.x" - Start compilation.
nmake /f Makefile.win
- Copy ip2proxy_apache.dll generated to the Apache modules directory.
-
Add following lines into httpd.conf
<IfModule mod_ip2proxy.c> IP2ProxyEnable <On|Off> # ENV will set server variables # NOTES will set apache notes # ALL will set both IP2ProxySetmode <ALL|ENV|NOTES> IP2ProxyDBFile <PATH_TO_IP2PROXY_BINARY_DATABASE> IP2ProxyDetectProxy <On|Off> </IfModule>
Module Settings
Name | Description |
---|---|
IP2ProxyEnable | ON | OFF. Enable or disable the IP2Proxy Apache Module. |
IP2ProxySetmode | ALL | ENV | NOTES. ENV will set the environment variables; NOTES will set the Apache NOTES variables; ALL will set both the ENV and NOTES variables. |
IP2PRoxyDBFile | Full qualified path to the IP2Proxy BIN database file. |
IP2ProxyDetectProxy | ON | OFF. If enabled, the module will detect the proxy IP address from X-Forwarded-For server variable. If disabled, IP address is from the REMOTE_ADDR server variable. |
Sample Codes
Apache .htaccess
RewriteEngine On
RewriteCond %{ENV:IP2PROXY_IS_PROXY} ^Yes$
RewriteRule ^(.*)$ http://www.google.co.uk [L]
Apache Mod Security
SecRule ENV:IP2PROXY_IS_PROXY "Yes" "deny,status:500,id:5000888,msg:'Block visitor using proxy server'"
Sample IP2Proxy Databases (BIN)
Sample Packages - BIN File | IPv4 + IPv6 |
---|---|
IP2Proxy PX1 | Download (20.69 MB) |
IP2Proxy PX2 | Download (23.17 MB) |
IP2Proxy PX3 | Download (27.55 MB) |
IP2Proxy PX4 | Download (32.29 MB) |
IP2Proxy PX5 | Download (33.72 MB) |
IP2Proxy PX6 | Download (34.01 MB) |
IP2Proxy PX7 | Download (36.69 MB) |
IP2Proxy PX8 | Download (37.84 MB) |
IP2Proxy PX9 | Download (37.69 MB) |
IP2Proxy PX10 | Download (45.43 MB) |
IP2Proxy PX11 | Download (46.34 MB) |