2010/11/19 Steffen Heil <li...@steffen-heil.de>:
> 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
org.apache.tomcat.util.http.mapper.Mapper

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.

http://tomcat.apache.org/bugreport.html#Patches_and_enhancement_requests

>

As a workaround, I can recommend looking at the UrlRewrite filter,
http://www.tuckey.org/urlrewrite/

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
http://wiki.apache.org/tomcat/FAQ/Password

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: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to