tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: Several hosts within one tomcat / catch-all problem
Date Fri, 19 Nov 2010 16:59:59 GMT
2010/11/19 Steffen Heil <>:
> Hi
> We have a web application which usually runs on a certain host all alone -
> it is the only context for that host.
> However, it allows to use different hostnames and therefore we use aliases
> in our server.xml per host.
> Now more and more users of those application want to use more subdomains and
> we have lots of trouble keeping the server.xml updates with all those
> hostnames.
> It would be a huge advantage to be able to tell tomcat to use all subdomains
> of a given domain in one step.
> Such as
> <Alias>*.domain.tdl</Alias>

I like it.

> Or
> <Alias catchAll="true">domain.tld</Alias>

Or a regexp...? (Or any configurable way). (Use some algorithm name
instead of "catchAll" argument naming).

> So here are my questions:
> 1) Can this somehow be archived using tomcat 6? (We are currently running
> 6.0.29.)
> 2) Can the somehow be archived using tomcat 7?
> (As I believe (and fear) the answer to the first two questions are "no", two
> more:)
> 3) Would it be difficult to add this feature?
> 4) Where would I start to work on if I tried to create a patch for tomcat
> myself?

The mapping is done in

Note, that Mapper.find(MapElement[], String) and similar methods
perform a binary search,
so how your use case can be plugged into it?

All requests go through Mapper, so its performance is important.

Maybe allow to apply additional processing if no explicit match was found?

> 5) Would there be any chances to get that patch later-on included into
> trunk?

I, personally, like the general idea of making it more flexible.

You may file an enhancement request in the Bugzilla (if there is none
yet), though one with a patch has more chances.


As a workaround, I can recommend looking at the UrlRewrite filter,

It might be that it will help, but I am no so sure.

BTW, you can put those names in an external file and use it in the
server.xml as an XML entity. Like the example in

and use JMX or call mapper.addHostAlias(..) directly to add aliases
programmatically at runtime.  (though there is no guarantee that the
Mapper API does not change between Tomcat minor releases).

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message