This is how I use mod_proxy in order to have apache proxy to the tomcat server. It's recommended to understand how mod_proxy works because it's easy to turn your apache server into an "open web proxy" if it's misconfigured. {{{ProxyRequests off}}} is a good option to use.

I've put this in a virtual host declaration:

{{{ProxyPass /wiki/    http://localhost:8080/JSPWiki/
ProxyPassReverse /wiki/     http://localhost:8080/JSPWiki/}}}

The jspwiki is accessed by http://virtualhost/wiki/

[http://httpd.apache.org/docs/mod/mod_proxy.html]

----
!See also [ApacheTomcatConnection]
----

An alternative option is to use the [AJPv13 Protocol|http://jakarta.apache.org/tomcat/connectors-doc/common/ajpv13a.html] through the use of JK connectors. 

Just download the module, load it in Apache, create and customise a {{workers.properties}} (or {{workers2.properties}} in the case of JK2) file in the Apache {{conf}} directory and it will connect to Tomcat using the appropriate connector (configured by default in Tomcat's {{server.xml}}). 

This is a more efficient way of achieving the same effect as a reverse proxy.

----


If you require editors to set a cookie in order to edit a page, ProxyPassReverse won't work.
Then you need to configure Tomcat with proxy support too. Like this:

* Edit server.xml
* Identify the connector which listens to port 8080 (search for port="8080")
* Add __proxyPort="80"__
* Add __proxyName="virtualhost"__ where virtualhost is the name of your host
* Restart Tomcat

[Tomcat 4.1 Proxy Howto | http://jakarta.apache.org/tomcat/tomcat-4.1-doc/proxy-howto.html]
------
If you have virtual host and use ProxyPass to forward to tomcat, you should use hostnames in the proxy.  So instead of 
{{{
ProxyPass /wiki/    http://localhost:8080/JSPWiki/
ProxyPassReverse /wiki/     http://localhost:8080/JSPWiki/
}}}
Use
{{{
ProxyPass /wiki/    http://virutalhost.server.com:8080/JSPWiki/
ProxyPassReverse /wiki/     http://virtualhost.server.com:8080/JSPWiki/
}}}
The wiki:baseUrl tag gets ServerName from the host Header, an in my case, the redirect pointing to an internal address, so the URL for stylesheets etc were not accessible externally.  You can use the following jsp to test the headers.
{{{
<html>
<head><title>Header test</title></head>
<body>
<%  java.util.Enumeration names = request.getHeaderNames();
        while (names.hasMoreElements()) {
            String name = (String)names.nextElement();
            out.println(name+": "+request.getHeader(name)+"<br>");
        }
    %>
</body>
</html>
}}}
-- Tested with Tomcat 5.0.28. Apache 2.0.52 and JSPWiki 2.3.55


----

How to minimize the Session?
Every request gets a new Session for the Proxy IP-Adress!

How to determine the real IP-Adress for the ServletContainer?
JSPWiki see the Proxy IP-Adress only!

--AnonymousCoward, 16-Nov-2006


----

I am having a similar problem. I have configured Apache to act as a proxy. All requests get redirected to tomcat. However it is now impossible to log in to the wiki. The login seems to work and the logs confirm that the login was successfull. Unfortunately the user is then redirected to the Main page were the login information is lost.

Only anonymous access is possible at the moment. This is a big problem for me as I need to disable Edit capabilities or anonymous users. Is there a way to set this up so that users are able to log in?

--[DanielRobinson|mailto:daniel@inveo.be], 19-Jan-2007

I am having a similar problem.  JSPWiki 2.5 beta with Tomcat 6.0.  Setup ContainerAuth and virtual host on Tomcat.  Everything works great except for preview.  It appears that the session is lost between the Edit page and the Preview Page.  [Bug Report Here | http://bugs.jspwiki.org/show_bug.cgi?id=109] for more info.