tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Klop <ronald-mailingl...@base.nl>
Subject Re: getServerName returns 'localhost'
Date Wed, 03 Mar 2010 14:05:43 GMT
Did you do something like this in server.xml?

<Engine defaultHost="localhost">
   <Host name="localhost" />
</Engine>

And your client goes to www.example.com, but you getServerName() returns "localhost" in stead
of "www.example.com"?

Ronald.

Op woensdag, 3 maart 2010 14:19 schreef vgud <ivan.gudilin@yahoo.com>:
> 
>  
> 
> Users use tomcat directly.
> 
> My server responds to different domain names, and I want to know which one
> users use. I try to get domain name by request.getServerName() but instead
> of domainName.com I get 'localhost'.
> 
> 
> awarnier wrote:
> > 
> > vgud wrote:
> >> Gentlemen,
> >> 
> >> I have the application which could be accessed from different domain
> >> addresses and I need to know from what domain request was sent. I try to
> >> get
> >> following from request:
> >> 
> >> getRemoteHost: 127.0.0.1
> >> getServerName: localhost
> >> 
> >> I use tomcat 5.5 and I suppose i should configure something to get
> >> correct
> >> domain name. Can anyone help me?? Any help will be apreciated.
> >> 
> > Are users accessing Tomcat directly ? or through an Apache front-end for 
> > example ?
> > 
> > Also, your question above is not very clear.  Can you revisit your usage 
> > of "from" above, and rephrase what you are trying to get exactly ?
> > Do you mean that your server responds to different domain names, and you 
> > want to know which one users use ?
> > Or do you want to know from which (user-side) IP address they are 
> > accesing your server ?
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://old.nabble.com/getServerName-returns-%27localhost%27-tp27767838p27768081.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message