Hi, I didn't get a response from the last mail I sent on this subject, but I hope I could borrow a few minutes of your time to at least point me in the direction of the relevant documentation on virtual hosts in tomcat... I am using Apache 1.3.20 and Tomcat 3.3 on Linux 2.4.5 We use a large number of virtual hosts in apache of the form xyz.subdomain.ourdomain.com. They all point to the same context, with the xyz art of the name being used by the webapp to determine how it was accessed and set content accordingly... In the apache configuration, the virtual host is defined using the ServerAlias directive and a wildcard, however, tomcat seems to need the Host tags in server.xml to exactly match the host header.. I was under a lot of pressure to get this working at the time, so hacked SimpleMapper1.java so that I could put a wildcard in my Host tag in server.xml according to the attached patch... The question I have is, what is the future for defining wildcard hosts in the Host tags in server.xml..? I would be more than happy to help with any development in this area, but I need to know what the plans are for virtual host definitions in server.xml If the reason that I didn't get a reply to my earlier mail is that I am being a complete muppet, please could you direct me to the relevent docs so I can demuppetize :-) Kind Regards, Chris
Index: SimpleMapper1.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/modules/mappers/SimpleMapper1.java,v retrieving revision 1.7 diff -u -r1.7 SimpleMapper1.java --- SimpleMapper1.java 2001/07/17 14:02:33 1.7 +++ SimpleMapper1.java 2001/07/25 16:05:44 @@ -606,6 +606,19 @@ if( myMap==null ) { myMap=(PrefixMapper)vhostMaps.get( host.toLowerCase() ); } + if( myMap==null ) { + //look for defined hosts that begin with *. then check if the requested host +matched + Enumeration vhosts = vhostMaps.keys(); + while(vhosts.hasMoreElements()) { + String vhostName = (String)vhosts.nextElement(); + if(vhostName.startsWith("*.")) { + if(host.endsWith(vhostName.substring(vhostName.indexOf("*.")+2))) +{ + myMap = (PrefixMapper)vhostMaps.get(vhostName); + break; + } + } + } + } } if( myMap==null ) myMap = this; // default server