On Fri, 6 Apr 2001, Jeff Kilbride wrote:
> Is there any plan to include pattern matching in the <Host> directive in the
> server.xml file? Right now, in order to catch requests to mydomain.com and
> www.mydomain.com, you have to use two <Host> directives. The problem with
> this is that it loads two instances of all your servlets/jsp's. I'm using DB
> connection pools and I'd like to avoid loading everything twice -- creating
> twice as many connections to my DB.
>
> Something like:
>
> <Host *.mydomain.com>
>
> or even being able to list multiple combinations, to avoid pattern matching:
>
> <Host mydomain.com www.mydomain.com>
>
> would really help. I'm using 3.2.1 and haven't tried any of the betas, yet.
> Is this available in 3.3 or 4.0?
>
> Thanks,
> --jeff
>
>
>
For Tomcat 4.0 you can declare a "default" host that is used when no other
host is matched specifically:
<Engine ... defaultHost="foo">
<Host name="foo" .../>
<Host name="bar" .../>
</Engine>
In this scenario, a request for "http://baz/..." that is received by this
Tomcat instance (because DNS points at this IP address) will be forwarded
to host "foo" for processing.
Craig McClanahan