Is it possible to filter/edit web content using Apache/Nginx/Lighttpd?
Solution 1:
I think I may answer my question myself. Personally I ended up using Apache mod_ext_filter module. It allows to use a custom program which gets the content from standard input and outputs what it likes based on input. So disallowing content may be done through outputting something like "Forbidden" if input is inappropriate.
Also there are Apache modules mod_sed and mod_line_edit for editing the content.
I didn't use other servers but it seems, like sendmoreinfo suggests, that HttpSubModule may be used for Nginx. As for lighttpd, this and this answers have some information.