Display a beautiful page when blocking a Nemesida WAF request with additional information instead of a normal 403
page. To activate the page, follow these steps:
- Create a file with custom page settings (e.g.
/etc/nginx/snippets/custom_pages.conf
):
## Error pages
error_page 403 =222 /403.html;
## Locations
location /403.html {
internal;
root /var/www/custom_pages/;
proxy_no_cache 1;
proxy_cache_bypass 1;
add_header host $host always;
add_header x-request-id $request_id always;
add_header x-remote-ip $remote_addr always;
add_header nemesidawaf-bt $nwaf_block_type always;
add_header nemesidawaf-cc $nwaf_cc always;
}
-
Create a direcory for storing cusom page (e.g.
/var/www/custom_pages/
) and save403.html
there. Set permissions to access for NGINX's user (e.g.chown -R nginx:nginx /var/www/custom_pages
). -
Include a file to NGINX for virtual host (e.g.
/etc/nging/conf.d/example.com.conf
):
server {
...
listen ...;
server_name ...;
...
include snippets/custom_pages.conf;
...
location / {
...
}
...
}
- Check NGINX's status and reload it
# nginx -t && service nginx reload
- After that, check that everything works correctly by sending a request with a Nemesida WAF's test signature using a browser:
http://example.com/nwaftest
In which case, check the NGINX error logs (e.g. /var/www/nginx/error.log
).