I tried to add some custom headers to all incoming requests based on their request method. After not getting the expected results, I learned about the IfIsEvil problem.
...
location / {
if ($request_method = 'GET') {
add header 'Header-A' '1'
add header 'Header-B' '2'
}
if ($request_method ~ ^(POST|DELETE) {
add header 'Header-A' '3'
add header 'Header-B' '4'
}
try_files ...
}
...
I'd like to learn how to deal with this issue and achieve the desired result. That helps me to move this logic from my PHP app to the web server itself and reduce the load on my FPM server.