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

cPanel Max Defers Occurring for an Account

While viewing exim_mainlog and seeing the following:   enforce_mail_permissions: Domain...

Create CXS Quarantine Directory

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

Recursive chmod / Permission Change Across Directories for a File Type

Recursive Permission Changes Across Directories   To change permissions recursively across...

Repairing and Optimizing all MySQL and MariaDB Databases on the Server

From time to time you will find repairing and optimizing your databases are necessary. From a...

Error: Multilib version problems found

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



Save 30% on web hosting - Use coupon code Hosting30