From: Rich Bowen Date: Tue, 13 Apr 2010 11:21:00 +0000 (+0000) Subject: Example for using mod_substitute a la mod_proxy_html, in proxy context, X-Git-Tag: 2.3.6~219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cd0c839a553c3bc57a8f58318aeec58d3220ba6;p=thirdparty%2Fapache%2Fhttpd.git Example for using mod_substitute a la mod_proxy_html, in proxy context, to fix hard-coded URLs in HTML. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@933559 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_substitute.html.en b/docs/manual/mod/mod_substitute.html.en index 0cbb1938f16..9f2cd5086a8 100644 --- a/docs/manual/mod/mod_substitute.html.en +++ b/docs/manual/mod/mod_substitute.html.en @@ -97,6 +97,29 @@ </Location>

+

A common use scenario for mod_substitute is the + situation in which a front-end server proxies requests to a back-end + server which returns HTML with hard-coded embedded URLs that refer + to the back-end server. These URLs don't work for the end-user, + since the back-end server is unreachable.

+ +

In this case, mod_substutite can be used to rewrite + those URLs into something that will work from the front end:

+ +

Rewriting URLs embedded in proxied content

+ ProxyPass /blog/ http://internal.blog.example.com
+ ProxyPassReverse /blog/ http://internal.blog.example.com/
+
+ Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i" +

+ +

ProxyPassReverse + modifies any Location (redirect) headers that are sent + by the back-end server, and, in this example, + Substitute takes care of the rest of the problem by + fixing up the HTML response as well.

+ +
diff --git a/docs/manual/mod/mod_substitute.xml b/docs/manual/mod/mod_substitute.xml index aba078e3a36..fb97f88f257 100644 --- a/docs/manual/mod/mod_substitute.xml +++ b/docs/manual/mod/mod_substitute.xml @@ -90,6 +90,29 @@ </Location> + +

A common use scenario for mod_substitute is the + situation in which a front-end server proxies requests to a back-end + server which returns HTML with hard-coded embedded URLs that refer + to the back-end server. These URLs don't work for the end-user, + since the back-end server is unreachable.

+ +

In this case, mod_substutite can be used to rewrite + those URLs into something that will work from the front end:

+ + Rewriting URLs embedded in proxied content + ProxyPass /blog/ http://internal.blog.example.com
+ ProxyPassReverse /blog/ http://internal.blog.example.com/
+
+ Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i" +
+ +

ProxyPassReverse + modifies any Location (redirect) headers that are sent + by the back-end server, and, in this example, + Substitute takes care of the rest of the problem by + fixing up the HTML response as well.

+