当尝试使用 mod_substitute 和 mod_filter 从文本内容类型替换内容时,它不适用于反向代理配置。
<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
这可能是什么原因?
这有效...