There is a setting somewhere in Tomcat (versions up to 4.1.X at least) where you enable/disable reverse DNS. Most of the time you want this off, but I think in your case you may need it turned on. I think the swtich is in the Tomcat server.xml, and it relates to the connector you are using. Its something like 'enableLookups'. While this sounds odd, two books I have state you need this to get names and not IP addresses. Also, the books mention using request.getRemoteHost(), and that it is effected by the settings in server.xml
Hope it helps, Al G ----- Original Message ----- From: Mike Curwen <[EMAIL PROTECTED]> Date: Wednesday, October 27, 2004 4:36 pm Subject: Virtual Hosts and useCanonical > Yup, I've asked about/commented about this before. I'm having > trouble with > Vhosts, server names, and how to get the value I want out of > request.getServerName(), and this is all with apache/jk/tomcat. > (apache is > in the 2's somewhere, jk (not jk2) and tomcat 4.1.30 and 5.0.29). > > "I'm only get the canonical name, help me get the alias" > http://marc.theaimsgroup.com/?l=tomcat-user&m=108315928213678&w=2 > > "I don't care about alias, get me canonical". > http://marc.theaimsgroup.com/?l=tomcat-user&m=106095508818371&w=2 > > So I know that both of these seem to have worked (or been doing a good > imitation of it). But now, for the life of me, I can't get > request.getServerName() to return the canonical ServerName from > httpd.conf. > > apache's httpd.conf > ------------------------------------------ > <VirtualHost 139.142.220.45:80> > UseCanonicalName On > ServerName devstar.myhost.com > ServerAlias www.devstar.myhost.com > DocumentRoot /home/data3/me20 > <Location "/WEB-INF/"> > AllowOverride None > deny from all > </Location> > JkMount /*.jsp tomcat1 > JkMount /login tomcat1 > ErrorLog /var/log/test/error_log > CustomLog /var/log/test/access_log common > </VirtualHost> > > > > > tomcat1's server.xml > ------------------------------------------ > <Host name="devstar.myhost.com" debug="0"> > <Alias>www.devstar.myhost.com > <Context path="" > docBase="/home/data3/myhost/" > etc... > > > > When I type in http://www.devstar.myhost.com , I was hoping that > request.getServerName() would give me devstar.myhost.com (without > the www). > But it doesn't. It (jk? tomcat?) doesn't seem to honour the > useCanonicaldirective. There seems to be some "controversy" about > this?http://www.mail-archive.com/tomcat- > [EMAIL PROTECTED]/msg32367.html > Have I been going slowly crazy, and this has never worked the way > I thought > it did? > > ------------------------------------------------ > mike curwen > intermediate programmer > globally boundless > > 204 885-7733 ext 227 > www.globallyboundless.com > > > ------------------------------------------------------------------- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]