IgnoreIP

The IgnoreIP directive configures NAXSI to bypass request filtering for specified IP addresses.

Syntaxignore_ip IP_ADDRESS [IP_ADDRESS ...];
Defaultnone
Contexthttp, server, location, limit_except
Arguments1+

Description

The IgnoreIP directive is part of the NGINX Anti XSS & SQL Injection module (NAXSI) and is used to specify a list of IP addresses that should be exempted from the module's filtering rules. When an incoming request originates from one of these specified IP addresses, NAXSI will not apply any of its security measures such as XSS or SQL Injection prevention, allowing those requests to pass through unfiltered. This can be particularly useful for whitelisting trusted internal services or development environments that may generate legitimate requests that would otherwise be flagged as potential threats by NAXSI’s rules.

The directive accepts one or more IP addresses as arguments. These can be written in standard dot-decimal notation (for IPv4 addresses) or as a hexadecimal representation (for IPv6 addresses). It is important to ensure that only trusted IP addresses are included in this directive, as doing otherwise could expose the application to security risks. If an IP address is specified more than once, it will be ignored; thus, all duplicate entries should be removed to maintain clarity and efficiency in configuration.

The IgnoreIP directive can be placed in different contexts of the NGINX configuration file, including http, server, location, and limit_except. This flexibility allows administrators to tailor their security configurations based on specific needs. For example, certain IPs may only require exemption from filtering in specific server blocks or locations, while others may need blanket exemption across the entire server configuration.

Config Example

server {
    listen 80;
    server_name example.com;

    # Ignore filtering for the development server IP
    ignore_ip 192.168.1.10;

    location / {
        # Other location configuration here
    }
}

Listing an IP address that has dynamic allocation may lead to unintentional security issues if that IP is reassigned later.

Ensure that all trusted IP addresses are clearly documented as the directive can potentially create significant security risks if misconfigured.

Having too many entries can clutter the configuration and make it harder to manage, especially if IP addresses change frequently.

← Back to all directives