Filtering content from response body HTML (mod_security or other WAFs)

Posted by Bingo Star on Pro Webmasters See other posts from Pro Webmasters or by Bingo Star
Published on 2014-02-20T07:29:47Z Indexed on 2014/08/19 16:31 UTC
Read the original article Hit count: 333

Filed under:
|
|

We have Apache on Linux with mod_security as the Web App Firewall (WAF) layer. To prevent content injections, we have some rules that basically disable a page containing some text patterns from showing up at all.

For example, if an HTML page on webserver has slur words (because some webmaster may have copied/pasted text without proofreading) the Apache server throws a 406 error.

Our requirement now is a little different: we would like to show the page as regular 200, but if such a pattern is matched, we want to strip out the offending content. Not block the entire page.

If we had a server side technology we could easily code for this, but sadly this is for a website with 1000s of static html pages.

Another solution might have been to do a cronjob of find/replace strings and run them on folders en-masse, maybe, but we don't have access to the file system in this case (different department).

We do have control over WAF or Apache rules if any. Any pointers or creative ideas?

© Pro Webmasters or respective owner

Related posts about apache

Related posts about security