Thats because your configuration is incomplete, in order for Apache to pass the cookie to the correct context you need to do some additional configuration (or alternatively use a connector like mod_jk)

You may need to configure the jvmRoute parameter in server.xml, this allows Apache to map to the correct Tomcat context, otherwise deploy your web app in the Tomcat root context.

<Connector port="8082"
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
              enableLookups="false"
              acceptCount="100" debug="0" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" jvmRoute=T1/>


You also need to add a server mapping in Apache, one way to do this easily is with a RewriteMap. (If you use Apache 2.2 then you could use the in-built mod_proxy_balancer module). I also use Apache 2.0 so I just make a static mapping, which looks something like this:


RewriteMap SERVERS rnd:/etc/apache2/servers.conf

--------------
servers.conf
--------------
T1  tomcat.server.com:8081
ALL tomcat.server.com:8081

#configure more instances for load balancing if you wish

Peter



mip wrote:
I'm trying to proxy my Tomcat web application through Apache 2.0 using
mod_proxy.

I have uncommented the following in my server.xml:

<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
    <!-- See proxy documentation for more information about using this. -->
    <Connector port="8082"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false"
               acceptCount="100" debug="0" connectionTimeout="20000"
               proxyPort="80" disableUploadTimeout="true" />

and I've added the following to my httpd.conf:

      <VirtualHost *:80>
              ServerName foo.bar.com
              ProxyPass  /  http://foobar.com:8082/app/
              ProxyPassReverse  /  http://foobar.com:8082/app/
      </VirtualHost>

The pages are being passed without any problems but the sessions are being
lost as cookies are not being passed. I'm guessing I need to add something
to the above stanza which rewrite the cookies. But what?

Reply via email to