Describe the bug
Removing parameters >4096 characters from waf_maps.conf to address #22 results in errors in waf_rules.conf regarding disallowed add_header directive on line 9. Commenting this out results in error moving to line 12, indicating that add_header is not permitted inside of if statements.
To Reproduce
Steps to reproduce the behavior:
- Address issues 21 and 22 as listed in descriptions of 22 and 23.
- Run
nginx -t
- See error
Alternately, same issue can be demonstrated by running nginx -t -c against a demo file containing
http {
server {
if ($true) {
add_header X-Test;
}
}
}
Expected behavior
No errors on evaluating configuration.
Error messages/logs
root@instance-20231029-2110:/home/ubuntu# nginx -t
2026/06/08 03:49:03 [emerg] 1169627#1169627: "add_header" directive is not allowed here in /etc/nginx/waf_patterns/waf_rules.conf:12
Environment (please complete the following information):
- OS: Ubuntu 24.04.1
- Python Version: N/a
- Web Server: Nginx 1.24.0
- Installation Method: downloaded pre-generated configs
Additional context
Research online seems to indicate that using a map is the alternative workflow. I know this project is already using maps, and I don’t understand enough about their use to suggest how this should be implemented instead.
Describe the bug
Removing parameters >4096 characters from waf_maps.conf to address #22 results in errors in waf_rules.conf regarding disallowed add_header directive on line 9. Commenting this out results in error moving to line 12, indicating that add_header is not permitted inside of if statements.
To Reproduce
Steps to reproduce the behavior:
nginx -tAlternately, same issue can be demonstrated by running
nginx -t -cagainst a demo file containingExpected behavior
No errors on evaluating configuration.
Error messages/logs
Environment (please complete the following information):
Additional context
Research online seems to indicate that using a map is the alternative workflow. I know this project is already using maps, and I don’t understand enough about their use to suggest how this should be implemented instead.