Whitelisting Multiple IPs with Mod_Security

Whitelisting Multiple IPs in ModSecurity

 

If ModSecurity is blocking legitimate requests from specific IP addresses, you can whitelist those IPs so their traffic bypasses the web application firewall rules.

 

Method: .htaccess

Add the following to your .htaccess file to disable ModSecurity for specific IPs:

<IfModule mod_security2.c>
SecRule REMOTE_ADDR "@ipMatch 1.2.3.4,5.6.7.8,9.10.11.12" "id:1000001,phase:1,allow,nolog"
</IfModule>

 

Replace the IP addresses with the ones you want to whitelist. Separate multiple IPs with commas.

 

Server-Level (Root Access Required)

For server-wide whitelisting, add the rule to /etc/apache2/conf.d/modsec/modsec2.user.conf and restart Apache. This is a server administrator task. If you are on shared hosting, contact support and provide the IP addresses you need whitelisted along with the URL that is being blocked.

  • 2 Users Found This Useful

Was this answer helpful?

Related Articles

VPS Time not Correct with Time Server

VPS Time Not Syncing With Time Server   If the time on your VPS is incorrect or drifting,...

cPanel Account - PHP Startup: Unable to load dynamic library

PHP Startup Error: Unable to Load Dynamic Library   The error "PHP Startup: Unable to load...

Error: Multilib version problems found

Finished Dependency Resolution Error:  Multilib version problems found. This often means that...

FTP Failed: Service check failed to complete Unable to connect to port 21

The service “ftpd” appears to be down. The system failed to connect to this service’s TCP/IP...

Create CXS Quarantine Directory

Creating a CXS Quarantine Directory   CXS (ConfigServer eXploit Scanner) quarantines...



Save 30% on web hosting - Use coupon code Hosting30