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






Reply via email to