Skip to content

Instantly share code, notes, and snippets.

@TomCan
Created September 2, 2021 07:13
Show Gist options
  • Save TomCan/b47257c8aa82389c1b3627490f61fa51 to your computer and use it in GitHub Desktop.
Save TomCan/b47257c8aa82389c1b3627490f61fa51 to your computer and use it in GitHub Desktop.
Apache reverse proxy with content rewrite
#
# use case: Reverse proxy for system that returns fully-qualified URLS in the content (eg. wsdl file)
#
# Requires: mod_proxy, mod_proxy_http and mod_substitute
#
ProxyPass / http://backend-server/Some/API/On/Some/Path/
ProxyPassReverse / http://backend-server/Some/API/On/Some/Path/
# Rewrite URLs in wsdl
# uses | as delimiter since / is in the pattern
# "n" flag as this is not a regular expression
# "i" flag for case insensitive match
# "q" flag to not flatten as we're not doing any other substitutions
Substitute "s|http://backend-server/Some/API/On/Some/Path/|https://my.proxy.hostname/|niq"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment