Modified: portals/site-live/applications/webcontent2/reverse-proxy-module.html URL: http://svn.apache.org/viewvc/portals/site-live/applications/webcontent2/reverse-proxy-module.html?rev=1901430&r1=1901429&r2=1901430&view=diff ============================================================================== --- portals/site-live/applications/webcontent2/reverse-proxy-module.html (original) +++ portals/site-live/applications/webcontent2/reverse-proxy-module.html Tue May 31 02:23:06 2022 @@ -1,630 +1,694 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - - - - - - - - - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>Apache Portals Applications - Apache Portals Web Content Application 2 - Reverse Proxy Module</title> - <style type="text/css" media="all"> - @import url("../css/maven-base.css"); - @import url("../css/maven-theme.css"); - @import url("../css/site.css"); - </style> - <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" /> - </head> - <body class="composite"> - <div id="banner"> - <a href="http://portals.apache.org/" id="bannerLeft"> - - <img src="../images/apache-portals.gif" alt="" /> - - </a> - <a href="http://portals.apache.org/applications/" id="bannerRight"> - - Apache Portals Applications - - </a> - <div class="clear"> - <hr/> - </div> - </div> - <div id="breadcrumbs"> - +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!-- Generated by Apache Maven Doxia Site Renderer 1.4 at 26 May 2022 --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Apache Portals Applications - + Apache Portals Web Content Application 2 - Reverse Proxy Module</title> + <style type="text/css" media="all"> + @import url("../css/maven-base.css"); + @import url("../css/maven-theme.css"); + @import url("../css/site.css"); + </style> + <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" /> + <meta name="Date-Revision-yyyymmdd" content="20220526" /> + <meta http-equiv="Content-Language" content="en" /> + + </head> + <body class="composite"> + <div id="banner"> + <a href="http://portals.apache.org/" id="bannerLeft"> + <img src="../images/apache-portals.gif" alt="Apache Software Foundation" /> + </a> + <a href="http://portals.apache.org/applications/" id="bannerRight"> + Apache Portals Applications + </a> + <div class="clear"> + <hr/> + </div> + </div> + <div id="breadcrumbs"> + + + <div class="xleft"> + <span id="publishDate">Last Published: 26 May 2022</span> + | <span id="projectVersion">Version: 1.0</span> + </div> + <div class="xright"> <a href="http://portals.apache.org/" class="externalLink" target="_nw" title="Portals">Portals</a> + | + <a href="http://portals.apache.org/jetspeed-2" class="externalLink" target="_nw" title="Jetspeed-2">Jetspeed-2</a> + | + <a href="http://portals.apache.org/bridges" class="externalLink" target="_nw" title="Bridges">Bridges</a> + + + </div> + <div class="clear"> + <hr/> + </div> + </div> + <div id="leftColumn"> + <div id="navcolumn"> + + + <h5>Essentials</h5> + <ul> + <li class="none"> + <a href="../index.html" title="Welcome">Welcome</a> + </li> + <li class="none"> + <a href="../news.html" title="News and Status">News and Status</a> + </li> + <li class="none"> + <a href="../download.html" title="Download">Download</a> + </li> + <li class="none"> + <a href="../getting-started.html" title="Getting Started">Getting Started</a> + </li> + </ul> + <h5>Subprojects</h5> + <ul> + <li class="none"> + <a href=".././portals-gems/index.html" title="Gems">Gems</a> + </li> + <li class="none"> + <a href=".././demo/index.html" title="Demo">Demo</a> + </li> + <li class="none"> + <a href=".././rss-main/index.html" title="RSS">RSS</a> + </li> + <li class="expanded"> + <a href=".././webcontent2/index.html" title="WebContent-2">WebContent-2</a> + <ul> + <li class="none"> + <a href=".././webcontent2/modules-overview.html" title="Modules Overview">Modules Overview</a> + </li> + <li class="none"> + <a href=".././webcontent2/content-rewriter-module.html" title="Content Rewriter Module">Content Rewriter Module</a> + </li> + <li class="none"> + <a href=".././webcontent2/reverse-proxy-module.html" title="Reverse Proxy Module">Reverse Proxy Module</a> + </li> + <li class="none"> + <a href=".././webcontent2/portlets-module.html" title="Portlets Module">Portlets Module</a> + </li> + <li class="none"> + <a href=".././webcontent2/war-module.html" title="WAR Module">WAR Module</a> + </li> + <li class="none"> + <a href=".././webcontent2/build-from-source.html" title="Build from source">Build from source</a> + </li> + <li class="none"> + <a href=".././webcontent2/apidocs/index.html" title="JavaDocs">JavaDocs</a> + </li> + <li class="none"> + <a href=".././webcontent2/faq.html" title="FAQ">FAQ</a> + </li> + </ul> + </li> + <li class="none"> + <a href=".././webcontent/index.html" title="WebContent-1">WebContent-1</a> + </li> + <li class="none"> + <a href=".././dbbrowser/index.html" title="DB Browser">DB Browser</a> + </li> + <li class="none"> + <a href=".././logging/index.html" title="Logging">Logging</a> + </li> + </ul> + <h5>Support</h5> + <ul> + <li class="none"> + <a href="../team-list.html" title="Project Team">Project Team</a> + </li> + <li class="none"> + <a href="../license.html" title="Project License">Project License</a> + </li> + <li class="none"> + <a href="http://wiki.apache.org/portals/applications" class="externalLink" title="Project Wiki">Project Wiki</a> + </li> + <li class="none"> + <a href="../mail-lists.html" title="Mailing List">Mailing List</a> + </li> + <li class="none"> + <a href="../issue-tracking.html" title="Issue Tracking">Issue Tracking</a> + </li> + </ul> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"> + <img class="poweredBy" alt="Built by Maven" src="../images/logos/maven-feather.png" /> + </a> + + + </div> + </div> + <div id="bodyColumn"> + <div id="contentBox"> + <!-- Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under + the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and + limitations under the License. --> - - - - - - <div class="xleft"> - Last Published: 4 March 2015 - </div> - <div class="xright"> <a href="http://portals.apache.org/" class="externalLink">Portals</a> - | - <a href="http://portals.apache.org/jetspeed-2" class="externalLink">Jetspeed-2</a> - | - <a href="http://portals.apache.org/bridges" class="externalLink">Bridges</a> - - + <div class="section"> +<h2>Reverse Proxy Module<a name="Reverse_Proxy_Module"></a></h2> + +<p> + The Reverse Proxy Module provides the features of + <a class="externalLink" href="http://en.wikipedia.org/wiki/Reverse_proxy">Reverse Proxy</a>, + and it consists of HTTP Client builder components, Reverse Proxy Command/Chain components, + and Reverse Proxy Servlets and Filters. + </p> + +<p> + By using Reverse Proxy Module, you can serve more sophisticated content + especially with a custom content rewriter, + and you can also allow Cross-Domain Scripting for trusted applications. + </p> - - - - - - </div> - <div class="clear"> - <hr/> + +<div class="section"> +<h3>Installtion<a name="Installtion"></a></h3> + +<p> + If you use <a class="externalLink" href="http://maven.apache.org/" target="_blank">Apache Maven</a> in your project, + then you can add the following dependency to use this module in your project. + </p> + +<p> + </p> +<div class="source"> +<pre> + <dependency> + <groupId>org.apache.portals.applications</groupId> + <artifactId>apa-webcontent2-reverse-proxy</artifactId> + <version>${webcontent2.version}</version> + </dependency> + </pre></div> + + +<p> + For more information on developing/testing, + see <a class="externalLink" href="https://svn.apache.org/repos/asf/portals/applications/webcontent/trunk/README" target="_blank">README</a> file. + </p> </div> - </div> - <div id="leftColumn"> - <div id="navcolumn"> - - - - - - - - <h5>Essentials</h5> - <ul> + +<div class="section"> +<h3>SimpleReverseProxyServlet<a name="SimpleReverseProxyServlet"></a></h3> + +<p> + A simple Reverse Proxy servlet can be configured in the web.xml like the following example: + </p> +<div class="source"> +<pre> + <!-- Reverse Proxy Servlet --> + <servlet> + <servlet-name>ReverseProxyServlet</servlet-name> + <servlet-class>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</servlet-class> + <init-param> + <param-name>mappings</param-name> + <param-value> + /WEB-INF/rproxy-mappings.yaml + </param-value> + </init-param> + <init-param> + <param-name>ssl-hostname-verifier</param-name> + <param-value>ALLOW_ALL_HOSTNAME_VERIFIER</param-value> + </init-param> + </servlet> + + <!-- Map /rproxyservlet/* path to the Reverse Proxy Servlet --> + <servlet-mapping> + <servlet-name>ReverseProxyServlet</servlet-name> + <url-pattern>/rproxyservlet/*</url-pattern> + </servlet-mapping> + </pre></div> + + +<p> + The servlet (<tt>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</tt>) + can have the following init parameter(s): + </p> +<table border="0" class="bodyTable"> + +<tr class="a"> - <li class="none"> - <a href="../index.html">Welcome</a> - </li> - - <li class="none"> - <a href="../news.html">News and Status</a> - </li> - - <li class="none"> - <a href="../download.html">Download</a> - </li> - - <li class="none"> - <a href="../getting-started.html">Getting Started</a> - </li> - </ul> - <h5>Subprojects</h5> - <ul> - - <li class="none"> - <a href=".././portals-gems/index.html">Gems</a> - </li> - - <li class="none"> - <a href=".././demo/index.html">Demo</a> - </li> - - <li class="none"> - <a href=".././rss-main/index.html">RSS</a> - </li> +<th>Name</th> - +<th>Default Value</th> - - - - - - - - - - - - - +<th>Example Value</th> + +<th>Description</th> + </tr> - +<tr class="b"> + +<td>mappings</td> - <li class="expanded"> - <a href=".././webcontent2/index.html">WebContent-2</a> - <ul> +<td></td> + +<td> + /WEB-INF/rproxy-mappings.xml + </td> + +<td> + YAML Configuration for path mappings and reverse path mappings. + <br /> + This parameter value can be any of the following: + +<ul> - <li class="none"> - <a href=".././webcontent2/modules-overview.html">Modules Overview</a> - </li> +<li>File path resource prefixed by 'file:'.</li> - <li class="none"> - <a href=".././webcontent2/content-rewriter-module.html">Content Rewriter Module</a> - </li> +<li>Classpath resource prefixed by 'classpath:'.</li> - <li class="none"> - <a href=".././webcontent2/reverse-proxy-module.html">Reverse Proxy Module</a> - </li> +<li>Context relative path resource prefixed by '/'.</li> - <li class="none"> - <a href=".././webcontent2/portlets-module.html">Portlets Module</a> - </li> +<li>YAML string</li> + </ul> + <br /> + <b><i>Note: </i></b> + Variables enclosed by '${' and '}' are expanded by Java System properties. + For example, you would get an expanded string, '/home/user1/rproxy-mappings.xml' + from '${user.home}/rproxy-mappings.xml' if the user's home directory is '/home/user1'. + </td> + </tr> + +<tr class="a"> + +<td>ssl-hostname-verifier</td> + +<td>BROWSER_COMPATIBLE_HOSTNAME_VERIFIER</td> + +<td>ALLOW_ALL_HOSTNAME_VERIFIER</td> + +<td> + The init parameter can be any of "ALLOW_ALL_HOSTNAME_VERIFIER", "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER" + or "STRICT_HOSTNAME_VERIFIER", case-insensitively. + </td> + </tr> + </table> + + +<p> + The Reverse Proxy mapping configuration in the example above can be like the following: + </p> +<div class="source"> +<pre> +--- !simple +local: /portals/applications/ +remote: http://portals.apache.org/applications/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + +--- !simple +local: /portals/bridges/ +remote: http://portals.apache.org/bridges/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + +--- !simple +local: /localhost/examples1/ +remote: //localhost:8080/webcontent2/examples1/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + +--- !regex +localPattern: ^/apache/(\w+)/(.*)$ +remoteReplace: http://$1.apache.org/$2 +remotePattern: ^http://(\w+)\.apache\.org/(.*)$ +localReplace: /apache/$1/$2 +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + +--- !regex +localPattern: ^/localhost/examples2/(.*)$ +remoteReplace: //localhost:8080/webcontent2/examples2/$1 +remotePattern: ^https?://localhost:8080/webcontent2/examples2/(.*)$ +localReplace: /localhost/examples2/$1 +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + +--- !simple +local: / +remote: http://apache.org/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + </pre></div> + + </div> + + +<div class="section"> +<h3>SimpleReverseProxyFilter<a name="SimpleReverseProxyFilter"></a></h3> + +<p> + You can use a servlet filter instead with the same Reverse Proxy Maping configuration like the following example: + </p> +<div class="source"> +<pre> + <!-- Reverse Proxy Filter --> + <filter> + <filter-name>ReverseProxyFilter</filter-name> + <filter-class>org.apache.portals.applications.webcontent2.proxy.filter.SimpleReverseProxyFilter</filter-class> + <init-param> + <param-name>filterPath</param-name> + <param-value>/rproxyfilter</param-value> + </init-param> + <init-param> + <param-name>mappings</param-name> + <param-value> + /WEB-INF/rproxy-mappings.yaml + </param-value> + </init-param> + <init-param> + <param-name>ssl-hostname-verifier</param-name> + <param-value>ALLOW_ALL_HOSTNAME_VERIFIER</param-value> + </init-param> + </filter> + + <!-- Map /rproxyfilter/* path to the Reverse Proxy Filter --> + <filter-mapping> + <filter-name>ReverseProxyFilter</filter-name> + <url-pattern>/rproxyfilter/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>INCLUDE</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + </pre></div> + + +<p> + The servlet filter (<tt>org.apache.portals.applications.webcontent2.proxy.filter.SimpleReverseProxyFilter</tt>) + can have the following init parameter(s): + </p> +<table border="0" class="bodyTable"> + +<tr class="a"> + +<th>Name</th> + +<th>Default Value</th> + +<th>Example Value</th> + +<th>Description</th> + </tr> + +<tr class="b"> + +<td>mappings</td> + +<td></td> + +<td> + /WEB-INF/rproxy-mappings.xml + </td> + +<td> + YAML Configuration for path mappings and reverse path mappings. + <br /> + This parameter value can be any of the following: + +<ul> - <li class="none"> - <a href=".././webcontent2/war-module.html">WAR Module</a> - </li> +<li>File path resource prefixed by 'file:'.</li> - <li class="none"> - <a href=".././webcontent2/build-from-source.html">Build from source</a> - </li> +<li>Classpath resource prefixed by 'classpath:'.</li> - <li class="none"> - <a href=".././webcontent2/apidocs/index.html">JavaDocs</a> - </li> +<li>Context relative path resource prefixed by '/'.</li> - <li class="none"> - <a href=".././webcontent2/faq.html">FAQ</a> - </li> - </ul> - </li> - - <li class="none"> - <a href=".././webcontent/index.html">WebContent-1</a> - </li> - - <li class="none"> - <a href=".././dbbrowser/index.html">DB Browser</a> - </li> - - <li class="none"> - <a href=".././logging/index.html">Logging</a> - </li> - </ul> - <h5>Support</h5> - <ul> - - <li class="none"> - <a href="../team-list.html">Project Team</a> - </li> - - <li class="none"> - <a href="../license.html">Project License</a> - </li> - - <li class="none"> - <a href="http://wiki.apache.org/portals/applications" class="externalLink">Project Wiki</a> - </li> - - <li class="none"> - <a href="../mail-lists.html">Mailing List</a> - </li> - - <li class="none"> - <a href="../issue-tracking.html">Issue Tracking</a> - </li> - </ul> - <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"> - <img alt="Built by Maven" src="../images/logos/maven-feather.png"></img> - </a> - - +<li>YAML string</li> + </ul> + <br /> + <b><i>Note: </i></b> + Variables enclosed by '${' and '}' are expanded by Java System properties. + For example, you would get an expanded string, '/home/user1/rproxy-mappings.xml' + from '${user.home}/rproxy-mappings.xml' if the user's home directory is '/home/user1'. + </td> + </tr> + +<tr class="a"> + +<td>ssl-hostname-verifier</td> + +<td>BROWSER_COMPATIBLE_HOSTNAME_VERIFIER</td> + +<td>ALLOW_ALL_HOSTNAME_VERIFIER</td> + +<td> + The init parameter can be any of "ALLOW_ALL_HOSTNAME_VERIFIER", "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER" + or "STRICT_HOSTNAME_VERIFIER", case-insensitively. + </td> + </tr> + </table> + + </div> - - - - - - </div> </div> - <div id="bodyColumn"> - <div id="contentBox"> - <subtitle></subtitle><authors><person name="Woonsan Ko" email="[email protected]"></authors><div class="section"><h2><a name="Reverse_Proxy_Module"></a>Reverse Proxy Module</h2> -<p> - The Reverse Proxy Module provides the features of - <a class="externalLink" href="http://en.wikipedia.org/wiki/Reverse_proxy">Reverse Proxy</a>, - and it consists of HTTP Client builder components, Reverse Proxy Command/Chain components, - and Reverse Proxy Servlets and Filters. - </p> -<p> - By using Reverse Proxy Module, you can serve more sophisticated content - especially with a custom content rewriter, - and you can also allow Cross-Domain Scripting for trusted applications. - </p> -<div class="section"><h3><a name="Installtion"></a>Installtion</h3> -<p> - If you use <a class="externalLink" href="http://maven.apache.org/">Apache Maven</a> in your project, - then you can add the following dependency to use this module in your project. - </p> -<p><div class="source"><pre> - <dependency> - <groupId>org.apache.portals.applications</groupId> - <artifactId>apa-webcontent2-reverse-proxy</artifactId> - <version>${webcontent2.version}</version> - </dependency> - </pre> -</div> -</p> -<p> - For more information on developing/testing, - see <a class="externalLink" href="https://svn.apache.org/repos/asf/portals/applications/webcontent/trunk/README">README</a> file. - </p> -</div> -<div class="section"><h3><a name="SimpleReverseProxyServlet"></a>SimpleReverseProxyServlet</h3> -<p> - A simple Reverse Proxy servlet can be configured in the web.xml like the following example: - <div class="source"><pre> - <!-- Reverse Proxy Servlet --> - <servlet> - <servlet-name>ReverseProxyServlet</servlet-name> - <servlet-class>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</servlet-class> - <init-param> - <param-name>mappings</param-name> - <param-value> - /WEB-INF/rproxy-mappings.yaml - </param-value> - </init-param> - <init-param> - <param-name>ssl-hostname-verifier</param-name> - <param-value>ALLOW_ALL_HOSTNAME_VERIFIER</param-value> - </init-param> - </servlet> - - <!-- Map /rproxyservlet/* path to the Reverse Proxy Servlet --> - <servlet-mapping> - <servlet-name>ReverseProxyServlet</servlet-name> - <url-pattern>/rproxyservlet/*</url-pattern> - </servlet-mapping> - </pre> -</div> -</p> -<p> - The servlet (<code>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</code>) - can have the following init parameter(s): - <table class="bodyTable"><tr class="a"><th>Name</th> -<th>Default Value</th> -<th>Example Value</th> -<th>Description</th> -</tr> -<tr class="b"><td>mappings</td> -<td></td> -<td> - /WEB-INF/rproxy-mappings.xml - </td> -<td> - YAML Configuration for path mappings and reverse path mappings. - <br /> - - This parameter value can be any of the following: - <ul><li>File path resource prefixed by 'file:'.</li> -<li>Classpath resource prefixed by 'classpath:'.</li> -<li>Context relative path resource prefixed by '/'.</li> -<li>YAML string</li> -</ul> -<br /> -<strong><em>Note: </em></strong> - Variables enclosed by '${' and '}' are expanded by Java System properties. - For example, you would get an expanded string, '/home/user1/rproxy-mappings.xml' - from '${user.home}/rproxy-mappings.xml' if the user's home directory is '/home/user1'. - </td> -</tr> -<tr class="a"><td>ssl-hostname-verifier</td> -<td>BROWSER_COMPATIBLE_HOSTNAME_VERIFIER</td> -<td>ALLOW_ALL_HOSTNAME_VERIFIER</td> -<td> - The init parameter can be any of "ALLOW_ALL_HOSTNAME_VERIFIER", "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER" - or "STRICT_HOSTNAME_VERIFIER", case-insensitively. - </td> -</tr> -</table> -</p> -<p> - The Reverse Proxy mapping configuration in the example above can be like the following: - <div class="source"><pre> ---- !simple -local: /portals/applications/ -remote: http://portals.apache.org/applications/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - ---- !simple -local: /portals/bridges/ -remote: http://portals.apache.org/bridges/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - ---- !simple -local: /localhost/examples1/ -remote: //localhost:8080/webcontent2/examples1/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - ---- !regex -localPattern: ^/apache/(\w+)/(.*)$ -remoteReplace: http://$1.apache.org/$2 -remotePattern: ^http://(\w+)\.apache\.org/(.*)$ -localReplace: /apache/$1/$2 -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - ---- !regex -localPattern: ^/localhost/examples2/(.*)$ -remoteReplace: //localhost:8080/webcontent2/examples2/$1 -remotePattern: ^https?://localhost:8080/webcontent2/examples2/(.*)$ -localReplace: /localhost/examples2/$1 -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - ---- !simple -local: / -remote: http://apache.org/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - </pre> -</div> -</p> -</div> -<div class="section"><h3><a name="SimpleReverseProxyFilter"></a>SimpleReverseProxyFilter</h3> -<p> - You can use a servlet filter instead with the same Reverse Proxy Maping configuration like the following example: - <div class="source"><pre> - <!-- Reverse Proxy Filter --> - <filter> - <filter-name>ReverseProxyFilter</filter-name> - <filter-class>org.apache.portals.applications.webcontent2.proxy.filter.SimpleReverseProxyFilter</filter-class> - <init-param> - <param-name>filterPath</param-name> - <param-value>/rproxyfilter</param-value> - </init-param> - <init-param> - <param-name>mappings</param-name> - <param-value> - /WEB-INF/rproxy-mappings.yaml - </param-value> - </init-param> - <init-param> - <param-name>ssl-hostname-verifier</param-name> - <param-value>ALLOW_ALL_HOSTNAME_VERIFIER</param-value> - </init-param> - </filter> - - <!-- Map /rproxyfilter/* path to the Reverse Proxy Filter --> - <filter-mapping> - <filter-name>ReverseProxyFilter</filter-name> - <url-pattern>/rproxyfilter/*</url-pattern> - <dispatcher>REQUEST</dispatcher> - <dispatcher>INCLUDE</dispatcher> - <dispatcher>FORWARD</dispatcher> - </filter-mapping> - </pre> -</div> -</p> -<p> - The servlet filter (<code>org.apache.portals.applications.webcontent2.proxy.filter.SimpleReverseProxyFilter</code>) - can have the following init parameter(s): - <table class="bodyTable"><tr class="b"><th>Name</th> -<th>Default Value</th> -<th>Example Value</th> -<th>Description</th> -</tr> -<tr class="a"><td>mappings</td> -<td></td> -<td> - /WEB-INF/rproxy-mappings.xml - </td> -<td> - YAML Configuration for path mappings and reverse path mappings. - <br /> - - This parameter value can be any of the following: - <ul><li>File path resource prefixed by 'file:'.</li> -<li>Classpath resource prefixed by 'classpath:'.</li> -<li>Context relative path resource prefixed by '/'.</li> -<li>YAML string</li> -</ul> -<br /> -<strong><em>Note: </em></strong> - Variables enclosed by '${' and '}' are expanded by Java System properties. - For example, you would get an expanded string, '/home/user1/rproxy-mappings.xml' - from '${user.home}/rproxy-mappings.xml' if the user's home directory is '/home/user1'. - </td> -</tr> -<tr class="b"><td>ssl-hostname-verifier</td> -<td>BROWSER_COMPATIBLE_HOSTNAME_VERIFIER</td> -<td>ALLOW_ALL_HOSTNAME_VERIFIER</td> -<td> - The init parameter can be any of "ALLOW_ALL_HOSTNAME_VERIFIER", "BROWSER_COMPATIBLE_HOSTNAME_VERIFIER" - or "STRICT_HOSTNAME_VERIFIER", case-insensitively. - </td> -</tr> -</table> -</p> -</div> -</div> -<div class="section"><h2><a name="Configuring_Reverse_Proxy_Mappings"></a>Configuring Reverse Proxy Mappings</h2> -<p> - In a Reverse Proxy Mappings configuration file, you can list all the (reverse) path mapping configurations - in <a class="externalLink" href="http://yaml.org/spec/1.1/">YAML</a> documents format. - </p> -<p> - At the moment, two built-in mapping configuration types are supported by default: - <ul><li>Simple mapping</li> -<li>Regular Expression based mapping</li> -</ul> -</p> -<p><strong><em>Note: </em></strong> - YAML configurations are internally parsed by using <a class="externalLink" href="https://code.google.com/p/snakeyaml/">SnakeYAML</a> library. - So, the document type hints and constructor hints are handled by SnakeYAML. - </p> -<div class="section"><h3><a name="Simple_mapping"></a>Simple mapping</h3> -<p> - Simple mapping allows you to map a local path to a remote URL - by replacing the configured local path prefix by the configured remote URL prefix. - And a remote URL is mapped to a local path by replacing the configured URL prefix - by the configured local path prefix. - </p> -<p><strong><em>Note: </em></strong> - A simple mapping should start with the line, '--- !simple', to denote a new YAML document with a built-in document type hint ('simple'). - </p> -<p> - For example, a simple mapping can be configured like the following: - <div class="source"><pre> ---- !simple -local: /portals/applications/ -remote: http://portals.apache.org/applications/ - </pre> -</div> -</p> -<p> - In this simple mapping, for example, - if the context path is '/webcontent2' and the request context relative path is '/portals/applications/a/b/c.html' - (e.g, 'http://localhost:8080/webcontent2/portals/applications/a/b/c.html'), - then the resolved remote URL will be 'http://portals.apache.org/applications/a/b/c.html'. - </p> -<p> - You can also set which content writer components should do rewrite the remote content - by setting 'contentRewriters' to a YAML map like the following example: - <div class="source"><pre> ---- !simple -local: /portals/applications/ -remote: http://portals.apache.org/applications/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - </pre> -</div> -</p> -<p> - With the example configuration above, you will create <code>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</code> - instance as content rewriter for 'text/html' content type from the remote content. - </p> -<p><strong><em>Note: </em></strong><code>!!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter []</code> - is interpreted by SnakeYAML in a special way: SnakeYAML instantiates <code>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</code> - class instance with the default constructor (as specified by '[]'). - Please see <a class="externalLink" href="https://code.google.com/p/snakeyaml/">SnakeYAML</a> homepage for details. - </p> -<p> - You can also set a scheme-less remote URL prefix like the following example. - In this case, the default URL scheme is inferred from the current servlet request (e.g, <code>javax.servlet.ServletRequest#getScheme()</code>). - <div class="source"><pre> ---- !simple -local: /localhost/examples1/ -remote: //localhost:8080/webcontent2/examples1/ -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - </pre> -</div> -</p> -</div> -<div class="section"><h3><a name="Regular_Expression_based_mapping"></a>Regular Expression based mapping</h3> -<p> - Regular Expression based mapping allows you to map a local path to a remote URL - by matching a local path by the configured local path pattern ('localPattern') and replacing it with the configured 'remoteReplace' string. - And a remote URL is mapped to a local path by matching a remote URL by the configured remote URL pattern ('remotePattern') and - replacing it with the configured 'localReplace' string. - </p> -<p><strong><em>Note: </em></strong> - A regular expression based mapping should start with the line, '--- !regex', to denote a new YAML document with a built-in document type hint ('regex'). - </p> -<p> - For example, a Regular Expression based mapping can be configured like the following: - <div class="source"><pre> ---- !regex -localPattern: ^/apache/(\w+)/(.*)$ -remoteReplace: http://$1.apache.org/$2 -remotePattern: ^http://(\w+)\.apache\.org/(.*)$ -localReplace: /apache/$1/$2 - </pre> -</div> -</p> -<p> - In this Regular Expression based mapping, for example, - if the context path is '/webcontent2' and the request context relative path is '/apache/portals/a/b/c.html' - (e.g, 'http://localhost:8080/webcontent2/apache/portals/a/b/c.html'), - then the resolved remote URL will be 'http://portals.apache.org/a/b/c.html'. - </p> -<p> - You can also set which content writer components should do rewrite the remote content - by setting 'contentRewriters' to a YAML map as well like the following example: - <div class="source"><pre> ---- !regex -localPattern: ^/apache/(\w+)/(.*)$ -remoteReplace: http://$1.apache.org/$2 -remotePattern: ^http://(\w+)\.apache\.org/(.*)$ -localReplace: /apache/$1/$2 -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - </pre> -</div> -</p> -<p> - With the example configuration above, you will create <code>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</code> - instance as content rewriter for 'text/html' content type from the remote content. - </p> -<p><strong><em>Note: </em></strong><code>!!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter []</code> - is interpreted by SnakeYAML in a special way: SnakeYAML instantiates <code>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</code> - class instance with the default constructor (as specified by '[]'). - Please see <a class="externalLink" href="https://code.google.com/p/snakeyaml/">SnakeYAML</a> homepage for details. - </p> -<p> - You can also set a scheme-less remote URL prefix like the following example. - In this case, the default URL scheme is inferred from the current servlet request (e.g, <code>javax.servlet.ServletRequest#getScheme()</code>). - <div class="source"><pre> ---- !regex -localPattern: ^/localhost/examples2/(.*)$ -remoteReplace: //localhost:8080/webcontent2/examples2/$1 -remotePattern: ^https?://localhost:8080/webcontent2/examples2/(.*)$ -localReplace: /localhost/examples2/$1 -contentRewriters: - text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] - </pre> -</div> -<em>Note: </em> The <code>remotePattern</code> can start with a specific scheme ("http" or "https") pattern - because the <code>remotePattern</code> is evaluated always on the current specific remote target URL or redirection location URL. - </p> -</div> -<div class="section"><h3><a name="Extending_the_Default_Reverse_Proxy_Service"></a>Extending the Default Reverse Proxy Service</h3> -<p> - In order to maximize the extensibility, Reverse Proxy Module is implemented with - the <a class="externalLink" href="http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern">Chain of Responsibility pattern</a> - by using <a class="externalLink" href="http://commons.apache.org/proper/commons-chain/">Apache Commons Chains</a> module. - </p> -<p> - By default, <code>org.apache.portals.applications.webcontent2.proxy.builder.DefaultProxyProcessingChainBuilder</code> - initializes and adds all the common commands to the internal reverse proxy service component. - However, you can always modify the chains of the commands in your extended servlet/filter/portlet classes. - </p> -<p> - For example, <a class="externalLink" href="https://svn.apache.org/repos/asf/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyServlet.java">org.apache.jetspeed.portlets.sso.SSOReverseProxyServlet</a> in j2-admin project - extends <code>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</code> - in order to replace the default <code>org.apache.portals.applications.webcontent2.proxy.command.InitHttpRequestCommand</code> - by <code>org.apache.jetspeed.portlets.sso.SSOInitHttpRequestCommand</code>. - Also, <code>SSOReverseProxyServlet</code> customizes the default <code>HttpClientContextBuilder</code> by a custom one, - <code>JetspeedHttpClientContextBuilder</code>, in order to build custom authentication states - based on the Jetspeed SSO Site credentials. - </p> -</div> -</div> - </div> - </div> - <div class="clear"> - <hr/> - </div> - <div id="footer"> - <div class="xright">© - 2004-2015 - Apache Software Foundation +<div class="section"> +<h2>Configuring Reverse Proxy Mappings<a name="Configuring_Reverse_Proxy_Mappings"></a></h2> + +<p> + In a Reverse Proxy Mappings configuration file, you can list all the (reverse) path mapping configurations + in <a class="externalLink" href="http://yaml.org/spec/1.1/" target="_blank">YAML</a> documents format. + </p> + +<p> + At the moment, two built-in mapping configuration types are supported by default: + </p> +<ul> - +<li>Simple mapping</li> + +<li>Regular Expression based mapping</li> + </ul> + + +<p> + <b><i>Note: </i></b> + YAML configurations are internally parsed by using <a class="externalLink" href="https://code.google.com/p/snakeyaml/" target="_blank">SnakeYAML</a> library. + So, the document type hints and constructor hints are handled by SnakeYAML. + </p> - - - - - - </div> - <div class="clear"> - <hr/> + +<div class="section"> +<h3>Simple mapping<a name="Simple_mapping"></a></h3> + +<p> + Simple mapping allows you to map a local path to a remote URL + by replacing the configured local path prefix by the configured remote URL prefix. + And a remote URL is mapped to a local path by replacing the configured URL prefix + by the configured local path prefix. + </p> + +<p> + <b><i>Note: </i></b> + A simple mapping should start with the line, '--- !simple', to denote a new YAML document with a built-in document type hint ('simple'). + </p> + +<p> + For example, a simple mapping can be configured like the following: + </p> +<div class="source"> +<pre> +--- !simple +local: /portals/applications/ +remote: http://portals.apache.org/applications/ + </pre></div> + + +<p> + In this simple mapping, for example, + if the context path is '/webcontent2' and the request context relative path is '/portals/applications/a/b/c.html' + (e.g, 'http://localhost:8080/webcontent2/portals/applications/a/b/c.html'), + then the resolved remote URL will be 'http://portals.apache.org/applications/a/b/c.html'. + </p> + +<p> + You can also set which content writer components should do rewrite the remote content + by setting 'contentRewriters' to a YAML map like the following example: + </p> +<div class="source"> +<pre> +--- !simple +local: /portals/applications/ +remote: http://portals.apache.org/applications/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + </pre></div> + + +<p> + With the example configuration above, you will create <tt>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</tt> + instance as content rewriter for 'text/html' content type from the remote content. + </p> + +<p> + <b><i>Note: </i></b> + <tt>!!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter []</tt> + is interpreted by SnakeYAML in a special way: SnakeYAML instantiates <tt>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</tt> + class instance with the default constructor (as specified by '[]'). + Please see <a class="externalLink" href="https://code.google.com/p/snakeyaml/" target="_blank">SnakeYAML</a> homepage for details. + </p> + +<p> + You can also set a scheme-less remote URL prefix like the following example. + In this case, the default URL scheme is inferred from the current servlet request (e.g, <tt>javax.servlet.ServletRequest#getScheme()</tt>). + </p> +<div class="source"> +<pre> +--- !simple +local: /localhost/examples1/ +remote: //localhost:8080/webcontent2/examples1/ +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + </pre></div> + </div> + + +<div class="section"> +<h3>Regular Expression based mapping<a name="Regular_Expression_based_mapping"></a></h3> + +<p> + Regular Expression based mapping allows you to map a local path to a remote URL + by matching a local path by the configured local path pattern ('localPattern') and replacing it with the configured 'remoteReplace' string. + And a remote URL is mapped to a local path by matching a remote URL by the configured remote URL pattern ('remotePattern') and + replacing it with the configured 'localReplace' string. + </p> + +<p> + <b><i>Note: </i></b> + A regular expression based mapping should start with the line, '--- !regex', to denote a new YAML document with a built-in document type hint ('regex'). + </p> + +<p> + For example, a Regular Expression based mapping can be configured like the following: + </p> +<div class="source"> +<pre> +--- !regex +localPattern: ^/apache/(\w+)/(.*)$ +remoteReplace: http://$1.apache.org/$2 +remotePattern: ^http://(\w+)\.apache\.org/(.*)$ +localReplace: /apache/$1/$2 + </pre></div> + + +<p> + In this Regular Expression based mapping, for example, + if the context path is '/webcontent2' and the request context relative path is '/apache/portals/a/b/c.html' + (e.g, 'http://localhost:8080/webcontent2/apache/portals/a/b/c.html'), + then the resolved remote URL will be 'http://portals.apache.org/a/b/c.html'. + </p> + +<p> + You can also set which content writer components should do rewrite the remote content + by setting 'contentRewriters' to a YAML map as well like the following example: + </p> +<div class="source"> +<pre> +--- !regex +localPattern: ^/apache/(\w+)/(.*)$ +remoteReplace: http://$1.apache.org/$2 +remotePattern: ^http://(\w+)\.apache\.org/(.*)$ +localReplace: /apache/$1/$2 +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + </pre></div> + + +<p> + With the example configuration above, you will create <tt>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</tt> + instance as content rewriter for 'text/html' content type from the remote content. + </p> + +<p> + <b><i>Note: </i></b> + <tt>!!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter []</tt> + is interpreted by SnakeYAML in a special way: SnakeYAML instantiates <tt>org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter</tt> + class instance with the default constructor (as specified by '[]'). + Please see <a class="externalLink" href="https://code.google.com/p/snakeyaml/" target="_blank">SnakeYAML</a> homepage for details. + </p> + +<p> + You can also set a scheme-less remote URL prefix like the following example. + In this case, the default URL scheme is inferred from the current servlet request (e.g, <tt>javax.servlet.ServletRequest#getScheme()</tt>). + </p> +<div class="source"> +<pre> +--- !regex +localPattern: ^/localhost/examples2/(.*)$ +remoteReplace: //localhost:8080/webcontent2/examples2/$1 +remotePattern: ^https?://localhost:8080/webcontent2/examples2/(.*)$ +localReplace: /localhost/examples2/$1 +contentRewriters: + text/html: !!org.apache.portals.applications.webcontent2.proxy.rewriter.DefaultReverseProxyTextLineContentRewriter [] + </pre></div> + <i>Note: </i> The <tt>remotePattern</tt> can start with a specific scheme ("http" or "https") pattern + because the <tt>remotePattern</tt> is evaluated always on the current specific remote target URL or redirection location URL. + + </div> + + +<div class="section"> +<h3>Extending the Default Reverse Proxy Service<a name="Extending_the_Default_Reverse_Proxy_Service"></a></h3> + +<p> + In order to maximize the extensibility, Reverse Proxy Module is implemented with + the <a class="externalLink" href="http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern" target="_blank">Chain of Responsibility pattern</a> + by using <a class="externalLink" href="http://commons.apache.org/proper/commons-chain/" target="_blank">Apache Commons Chains</a> module. + </p> + +<p> + By default, <tt>org.apache.portals.applications.webcontent2.proxy.builder.DefaultProxyProcessingChainBuilder</tt> + initializes and adds all the common commands to the internal reverse proxy service component. + However, you can always modify the chains of the commands in your extended servlet/filter/portlet classes. + </p> + +<p> + For example, <a class="externalLink" href="https://svn.apache.org/repos/asf/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyServlet.java" target="_blank">org.apache.jetspeed.portlets.sso.SSOReverseProxyServlet</a> in j2-admin project + extends <tt>org.apache.portals.applications.webcontent2.proxy.servlet.SimpleReverseProxyServlet</tt> + in order to replace the default <tt>org.apache.portals.applications.webcontent2.proxy.command.InitHttpRequestCommand</tt> + by <tt>org.apache.jetspeed.portlets.sso.SSOInitHttpRequestCommand</tt>. + Also, <tt>SSOReverseProxyServlet</tt> customizes the default <tt>HttpClientContextBuilder</tt> by a custom one, + <tt>JetspeedHttpClientContextBuilder</tt>, in order to build custom authentication states + based on the Jetspeed SSO Site credentials. + </p> + </div> + </div> - </body> -</html> + + + + + </div> + </div> + <div class="clear"> + <hr/> + </div> + <div id="footer"> + <div class="xright"> + Copyright © 2004-2022 + <a href="http://www.apache.org/">Apache Software Foundation</a>. + All Rights Reserved. + + </div> + <div class="clear"> + <hr/> + </div> + </div> + </body> +</html>
