Skip to content

Nginx + libmodsecurity + custom 403 page = no audit_log #1459

Closed
@averges

Description

@averges

When I configure nginx to show a custom 403 page (without url redirect), modsecurity stops logging into audit_log.

Nginx 1.13.0
Modsecurity v3/master

Nginx config:

server {
       error_page 403 =403 /custom_403.php; <- No logs in audit_log 
       #error_page 403 =403 custom_403.php;  <- Logging OK

       location / {
             modsecurity on;
             modsecurity_rules_file modsecurity.conf;

             proxy_set_header Host $host;
             proxy_pass_header on;
             proxy_pass http://backend;
       }

       location /custom_403.php {
             client_max_body_size    10m;
             client_body_buffer_size 256k;

             include fastcgi_params;
             fastcgi_pass   php-fpm:9000;
             fastcgi_index custom_403.php;
             fastcgi_param  SCRIPT_FILENAME  /var/www/html/custom_403.php;
             fastcgi_intercept_errors on;
             fastcgi_buffer_size 128k;
             fastcgi_buffers 256 16k;
             fastcgi_busy_buffers_size 256k;
             fastcgi_temp_file_write_size 256k;
       }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions