You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Benjamin <db...@tech.offroadcapital.com> on 2001/04/13 13:52:35 UTC

mod_jk - different ports, different contexts?

Sorry if this is a FAQ,

Can mod_jk be configured so that multiple apache sites
running on the same host, but using different ports, 
can connect to a single tomcat server, yet view different contexts?

some examples

A production line

 http://www.foo.com:8080/jsp/hello.jsp  --->  /devel/foo/jsp/hello.jsp
 http://www.foo.com:8081/jsp/hello.jsp  --->  /test/foo/jsp/hello.jsp
 http://www.foo.com:80/jsp/hello.jsp    --->  /prod/foo/jsp/hello.jsp

differing levels of security

 http://www.foo.com:80/jsp/hello.jsp      --->  /foo/public/jsp/hello.jsp
 http://www.foo.com:443/jsp/hello.jsp     --->  /foo/secure/jsp/hello.jsp
 http://www.foo.com:8888/jsp/hello.jsp    --->  /foo/client/jsp/hello.jsp

I'm using mod_jk (ajp13) to communicate between apache and tomcat.

In each case the Apache httpd.conf/mod_jk.conf command for these contexts is

 JkMount /jsp/*.jsp ajp13

On the tomcat side, in server.xml, the <Context> config is, say

        <Host name="www.foo.com">       
              <Context path="/j1"
                       docBase="/devel/foo/jsp"
                       crossContext="false"
                       debug="0"
                       reloadable="true" >
              </Context>
        </Host>

The following variations on the <Host> statement, don't seem to work...

 <Host name="www.foo.com:8080">
 <Host name="www.foo.com" port="8080">

I guess the real question is whether Apache includes the Listen port in
its ajp13 request to Tomcat, and whether Tomcat can use this to select
the appropriate context to use.


==> Can anyone confirm or deny that DNS host name or IP address is the only 
==> way to differentiate Apache servers connecting to Tomcat?

Thanks in advance for any help on this.

Please reply to the list, as I do read it.  I realize the question has
been asked in a few forms before, but often in the context of Tomcat
being the standalone server.  And the answers have been a little unclear.

I'll admit to having had read the documentation, tried a few things, 
read through the ContextManager.java code (I think this is the right
place for parsing the server.xml info) and I'm not very optimistic
that there is a way to do this.

But as a last resort, maybe the mailing list has some thoughts?

Regards,

Dave Benjamin
dbenjamin@tech.offroadcapital.com