I have a working Reverse Proxy that is active only on a specific Location in my site, in this case for example: www.example.com/reverseproxy/site1
I am reverse proxying site1. I want to replace some part of the body of every page that is proxied so I tried to use mod_substitute, the problem is that I can't get it to work under <Location /reverseproxy>
This is my httpd (SSL is enabled):
<VirtualHost _default_:443>
ProxyPassInterpolateEnv On
RewriteEngine On
... Some rewrite rules
RewriteRule /?reverseproxy/http(s*):/([^\/]*)/*(.*) "http$1://$2/$3" [P]
SSLProxyEngine On
ProxyPassReverse "/reverseproxy/http${ssl}://${page}" http${ssl}://${page} interpolate
SetOutputFilter INFLATE;proxy-html;SUBSTITUTE;DEFLATE;
ProxyHTMLInterp On
ProxyHTMLExtended Off
...Some ProxyURLMap
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|<body>|<body1>|"
</VirtualHost>
This substitute does work but it applies to all the pages and not only to /reverseproxy
. When I try to put it in <Location /reverseproxy>
it does not work, it just ignores it:
<Location /reverseproxy>
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|<body>|<body1>|"
</Location>
What I tried:
I tried adding
RequestHeader unset Accept-Encoding
outside the <Location>
tag but it didn't work
I tried then adding this
SetOutputFilter SUBSTITUTE;DEFLATE
in the <Location /reverseproxy>
tag but no luck
And as someone suggested tried with this filterchain
FilterDeclare filter
FilterProvider filter SUBSTITUTE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterDeclare unpackGZIP
FilterProvider unpackGZIP INFLATE "resp('Content-Encoding') == 'gzip'"
<Location /reverseproxy>
FilterChain unpackGZIP filter DEFLATE
Everything else inside the Location works, it just seems to ignore the substitution.