Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

Since you are on Linux, you surely have perl installed, and there is nothing more powerful than that to do what you want.

We can not tell you how to write the exact code to fix the problem, but you have the solution on the server, for sure. Just look for information on how to write code in perl as CGI.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.