]> granicus.if.org Git - apache/commitdiff
Example for using mod_substitute a la mod_proxy_html, in proxy context,
authorRich Bowen <rbowen@apache.org>
Tue, 13 Apr 2010 11:21:00 +0000 (11:21 +0000)
committerRich Bowen <rbowen@apache.org>
Tue, 13 Apr 2010 11:21:00 +0000 (11:21 +0000)
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

docs/manual/mod/mod_substitute.html.en
docs/manual/mod/mod_substitute.xml

index 0cbb1938f16e0737f165ee9c126bbb71e05e000f..9f2cd5086a8e29c8aed90c2ef9afdf02a899cbda 100644 (file)
         &lt;/Location&gt;
     </code></p></div>
 
+    <p>A common use scenario for <code>mod_substitute</code> 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.</p>
+
+    <p>In this case, <code>mod_substutite</code> can be used to rewrite
+    those URLs into something that will work from the front end:</p>
+
+    <div class="example"><h3>Rewriting URLs embedded in proxied content</h3><p><code>
+    ProxyPass /blog/ http://internal.blog.example.com<br />
+    ProxyPassReverse /blog/ http://internal.blog.example.com/<br />
+    <br />
+    Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i"
+    </code></p></div>
+
+    <p><code class="directive"><a href="../mod/mod_proxy.html#proxypassreverse">ProxyPassReverse</a></code>
+    modifies any <code>Location</code> (redirect) headers that are sent
+    by the back-end server, and, in this example,
+    <code>Substitute</code> takes care of the rest of the problem by
+    fixing up the HTML response as well.</p>
+
+
 </div>
 </div>
 <div class="bottomlang">
index aba078e3a36f45e73e17e31207ca2735d83d0f3c..fb97f88f2577ee56375889275d6e25391b2c0b75 100644 (file)
         </indent>
         &lt;/Location&gt;
     </example>
+
+    <p>A common use scenario for <code>mod_substitute</code> 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.</p>
+
+    <p>In this case, <code>mod_substutite</code> can be used to rewrite
+    those URLs into something that will work from the front end:</p>
+
+    <example><title>Rewriting URLs embedded in proxied content</title>
+    ProxyPass /blog/ http://internal.blog.example.com<br />
+    ProxyPassReverse /blog/ http://internal.blog.example.com/<br />
+    <br />
+    Substitute "s|http://internal.blog.example.com/|http://www.example.com/blog/|i"
+    </example>
+
+    <p><directive module="mod_proxy">ProxyPassReverse</directive>
+    modifies any <code>Location</code> (redirect) headers that are sent
+    by the back-end server, and, in this example,
+    <code>Substitute</code> takes care of the rest of the problem by
+    fixing up the HTML response as well.</p>
+
 </usage>
 </directivesynopsis>