先生们,尝试在流的页脚中插入 google analytics/piwik javascript 位。
出于某种原因,我认为您不能使用 ProxyPass/ProxyPassReverse/vhosts 来执行此操作...
如果有人能给我指明正确的方向,我将不胜感激!
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /usr/local/apache/htdocs/
ServerName search.domain.com
ServerAlias search.domain.com
ErrorLog logs/search.domain.com-error_log
#CustomLog logs/search.domain.com-access.log combined
CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/search.domain.com-access_log 100M" common
<Proxy balancer://searchdomain>
BalancerMember http://157.150.186.79
BalancerMember http://157.150.35.20
</Proxy>
ExtFilterDefine piwik-search.domain.com cmd="/bin/sed s/<\/html>/<!-- Piwik --> <script type=\"text/javascript\"> var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"https://weblog.domain.com/\" : \"http://weblog.domain.com/\"); document.write(unescape(\"%3Cscript src='\" + pkBaseURL + \"piwik.js' type='text/javascript'%3E%3C/script%3E\")); </script><script type=\"text/javascript\"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + \"piwik.php\", 7); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src=\"http://weblog.domain.com/piwik.php?idsite=7\" style=\"border:0\" alt=\"\" /></p></noscript> <\/html>/ig"
#AddOutputFilter piwik-search.domain.com htm html
AddOutputFilter piwik-search.domain.com htm html shtml
RewriteEngine on
ProxyPass / balancer://searchdomain/
ProxyPassReverse / balancer://searchdomain/
</VirtualHost>
答案1
我没有解决方案,但答案的根本原因是 http 压缩。服务器在 http 级别压缩数据。代理看到压缩数据,字符串匹配失败。
我也遇到过同样的问题。不知道最佳解决方案是什么,但我对其他答案非常感兴趣。