This allows, for example, changing the host or path in a HTTP link on a JSON response body.
Enable mod_filter
and mod_substitute
. Adjust vHost according to Apache version.
<VirtualHost *:443>
ServerName wf.bcn.abiquo.com
...
FilterDeclare rename_host
FilterProvider rename_host SUBSTITUTE resp=Content-Type $json
<Directory "/var/www/html/ui">
...
<Location /api>
ProxyPass ajp://localhost:8010/api
ProxyPassReverse ajp://localhost:8010/api
FilterChain rename_host
Substitute s/wf.bcn.abiquo.com/test.example.org/i
</Location>
...
...
FilterDeclare rename_cms
FilterProvider rename_cms SUBSTITUTE "%{CONTENT_TYPE} =~ /json/"
...
<Location "/cmsSwisscom">
ProxyPass https://stmz000238.tmzintra.ch/Appclusive/api
Header add "Access-Control-Allow-Origin" "*"
FilterChain rename_cms
Substitute "s,https://stmz000238\.tmzintra\.ch/Appclusive/api/,http://localhost/cmsSwisscom/,i"
</Location>
...