Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Gents, Trying to insert a google analytics/piwik javascript bit in the footer of the stream.

For some reason, I dont think you can do this with ProxyPass/ ProxyPassReverse/ vhosts...

If someone can point me in the right direction, it would be greatly appreciated!

<VirtualHost *:80>
        DocumentRoot /usr/local/apache/htdocs/
        ErrorLog logs/
        #CustomLog logs/ combined

        CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/ 100M" common

        <Proxy balancer://searchdomain>

        ExtFilterDefine cmd="/bin/sed s/<\/html>/<!-- Piwik --> <script type=\"text/javascript\"> var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"\" : \"\"); 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=\"\" style=\"border:0\" alt=\"\" /></p></noscript> <\/html>/ig"
        #AddOutputFilter htm html
        AddOutputFilter htm html shtml

        RewriteEngine on
        ProxyPass / balancer://searchdomain/
        ProxyPassReverse / balancer://searchdomain/

share|improve this question

I don't have a solution, but the root cause of the answer is http compression. The server is compressing data at the http level. The proxy sees compressed data and string matching fails.

I've seen the same issue. Don't know what the best solution is, but I'm very interested in other answers.

share|improve this answer
!!! I bet you its the NetScalers!!! :) Will test and revert :) – CMag Feb 27 '12 at 23:44
actually, no , fail.... testing directly to the server :( – CMag Mar 1 '12 at 21:48
Too bad. This was the cause here when we could not use ExtFilter properly. Compression can come from the web server itself. My colleague tested by replacing all 'A's with a 'B', the result was an error message saying that the compressed stream is invalid. I have no other suggestion. – Le Fab Mar 5 '12 at 7:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.