Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to use any of the following HTTP servers: Apache, Nginx or Lighttpd as a proxy to make the following:

  • Disallow certain HTTP bodies (web pages) based on their content (e. g., words)
  • Substitute certain content with another (e. g., by regular expression)

Not only core functionality but also modules may be used. Also, I may consider writing my own module, so the question would be then if it's easy to write such a module for any of these servers.

I know that Squid + DansGuardian/SquidGard allow this but I am interested in mentioned software.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

nginx stock module ngx_http_sub_module supports simple search and replace.

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.