Apache-2.2

可以在不同的網路伺服器(nginx、apache、iis 等)中重寫響應主體

  • July 17, 2016

我正在對常用 Web 伺服器之間的差異進行個人研究。當涉及到特定功能時,我正在努力尋找明確的答案,對我來說最重要的是:動態重寫響應的能力。

場景:Web 伺服器(apache、nginx、iis、varnish、haproxy)被部署為反向代理或應用程序伺服器代理(以 nginx –> 乘客為例)。

問題:在哪些網路伺服器中以及如何重寫響應正文。關於此類操作的易用性和性能的評論或 2 也會有所幫助。

我的研究

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

還有什麼我忘記了嗎?謝謝。

以這張表結束:

**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

引用自:https://serverfault.com/questions/789743