I want to modify the response content using ModSecurity only if the file resides on a particular directory. I implemented the rules like this:
SecRule REQUEST_URI "@contains /admin/" "phase:2,chain,t:none,t:urlDecode,t:lowercase,t:normalizePath,deny,log"
SecRule STREAM_OUTPUT_BODY "@rsub s/test/replaced_string/" "phase:4,t:none,log,pass,msg:'String replaced'"
But after writing this rule, when I restart apache2, modsecurity gives me an error: ModSecurity: Disruptive actions can only be specified by chain starter rules
. I tried writing the rules other way round too but it didn't help.
Any idea why it happens ?