Possibility of rewriting response bodies in different webservers (nginx, apache, iis, etc.)

Posted on

Possibility of rewriting response bodies in different webservers (nginx, apache, iis, etc.) – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, nginx, iis, reverse-proxy, varnish.

I’m doing a personal research on the differences between commonly used web servers.
I’m struggling to find clear answers when it comes to particular features and most importantly for me: ability to rewrite response body on the fly.

Scenario: a web server (apache, nginx, iis, varnish, haproxy) is deployed as a reverse proxy or a application server proxy (nginx –> passenger as an example).

Question: in which webservers and how is it possible to rewrite the response body. A remark or 2 on the ease and performance of such operation would be helpful as well.

My research:

Content rewritting:

Nginx: ngx_http_sub_module
Nginx: LUA body_filter: https://groups.google.com/forum/embed/#!topic/openresty-en/Gj-s_hARc84 
Apache: mod_substitute
Apache: starting from 2.3 LUA can be used as a scripting language (and the response body rewriting with it is possible)
IIS: does not seem top be possible?
Varnish: possible, but hacky: https://github.com/aivarsk/libvmod-rewrite 
HAproxy: not possible, although it might be possible with LUA in the future

Anything else I forgot?
Thanks.

Ended up with this table:

**Nginx**: ngx_http_sub_module --> http://p.defau.lt/?A6UukYFKZrYLalJ5KOuTKg 
**Nginx**: Nginx + lua. LUA body_filter --> http://p.defau.lt/?0ZxLWENoEkFIRD17QlEtbQ 
**Apache**: Apache Module mod_substitute --> http://p.defau.lt/?IS8u2mnAQTSHs4qEl_MSFQ 
**Apache**: As of version 2.3 LUA can be used as a scripting language for Apache. Response body rewriting is possible there as well. --> http://p.defau.lt/?tTAqWfA8sezQZkmvI3LnFw 
**Varnish**: Possible, but hacky: https://github.com/aivarsk/libvmod-rewrite 
**HAproxy**: Not possible. Might be possible with LUA in the future

Leave a Reply

Your email address will not be published. Required fields are marked *