Created
January 21, 2015 21:09
-
-
Save gadelkareem/ed8692ae4d0677dd04e8 to your computer and use it in GitHub Desktop.
Simple way to replace URLs for proxied websites using mod filter and substitute. more http://gadelkareem.com/2015/01/21/replacing-urls-html-js-mod_proxy-apache-2-2/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ProxyPreserveHost On | |
ServerName proxy-test.example.com | |
FilterDeclare MYFILTER | |
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $text/ | |
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/xml | |
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/json | |
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/javascript | |
<Location /> | |
#disable gzip | |
RequestHeader unset Accept-Encoding | |
FilterChain MYFILTER | |
Substitute "s!(images|static|test).example.com!proxy-$1.example.com!i" | |
</Location> | |
ProxyPass / http://test.example.com/ | |
ProxyPassReverse / http://test.example.com/ | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment