Apache/2.2.22 (Ubuntu) mod_proxy, mod_filter and mod_substitute

apache-2.2reverse-proxy

When trying to substitute content from text content-types using mod_substitute and mod_filter it does not work with reverse proxy config.

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

The request header looks like

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

What could be the cause of this?

Best Answer

This worked...

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