Skip to content

Instantly share code, notes, and snippets.

@ArtemGr
Created October 15, 2013 15:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtemGr/6993113 to your computer and use it in GitHub Desktop.
Save ArtemGr/6993113 to your computer and use it in GitHub Desktop.
Apache 2.4 reverse proxy with URL substitution.
# Turn compression off in order for the Substitute to work.
RequestHeader unset Accept-Encoding "expr=%{REQUEST_URI} =~ m#^/news#"
# http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#examples
ProxyPass /news http://newspaper.ipage.am
ProxyPassReverse /news http://newspaper.ipage.am
Substitute "s|http://newspaper.ipage.am|http://mercatos.net/news|n"
# In order for the substitute module to work we have to add it to the filter chain.
FilterDeclare Substitute
FilterProvider Substitute SUBSTITUTE "%{REQUEST_URI} =~ m#^/news#"
FilterChain +Substitute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment