Apache / 2.2.22(Ubuntu)mod_proxy,mod_filter和mod_substitute

当尝试使用mod_substitute和mod_filterreplace来自文本内容types的内容时,它不适用于反向代理configuration。

<virtualhost *:80> ServerName rp ProxyRequests Off ProxyPreserveHost Off <Location /> ProxyPass http://site/ ProxyPassReverse http://site/ FilterDeclare replace FilterProvider replace SUBSTITUTE resp=Content-Type $text/ FilterProtocol replace "change=yes proxy=transform cache=no" FilterChain +replace FilterTrace replace 1 Substitute "s/foo/bar/in" </Location> </virtualhost> 

请求标题看起来像

 Host: site Cache-Control: max-age=0 Accept: image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36 Referer: http://rp/ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 X-Forwarded-For: 10.1.1.107 X-Forwarded-Host: rp X-Forwarded-Server: rp Connection: Keep-Alive 

这可能是什么原因?

这工作…

 <VirtualHost *:80> ProxyRequests Off ProxyPreserveHost Off ServerName rp ProxyPass / http://site/ ProxyPassReverse / http://site/ RewriteEngine On SetOutputFilter INFLATE;proxy-html;DEFLATE ProxyHTMLURLMap http://site http://rp </VirtualHost>