tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Virtual Hosts and useCanonical
Date Thu, 28 Oct 2004 05:21:09 GMT
request.getServerName() is the value of the Host header.  You want 
request.getLocalName().

"Mike Curwen" <g_dev9xq@globallyboundless.com> wrote in message 
news:01d801c4bc6c$f666d240$6f00000a@BALTHAZAR...
> 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</Alias>
>  <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 useCanonical
> directive.  There seems to be some "controversy" about this?
> http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message