You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Januski, Ken" <kj...@phillynews.com> on 2003/01/28 00:03:15 UTC

Where does request.getServerName get name from?

I know this is a simple question but just can't find the answer. I have two
instances of Tomcat running on one server. Each has a login page as the
entry point and that page includes a choice of databases. I'd like the
default database (i.e. one at top of select list) to be determined by
request.getServername(). The problem I'm having is that I'm getting a name
for one IP address and and IP address for the other. I can't figure out why
the second one won't give me a name. I can live with the IP address but I'd
prefer to get a name instead. Can anyone shed any light on where
request.getServerName() gets its name from?

I should add that the server name is in DNS correctly and enable lookups is
set to true.

Thanks for any info.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Where does request.getServerName get name from?

Posted by Bill Barker <wb...@wilshire.com>.
"Craig R. McClanahan" <cr...@apache.org> wrote in message
news:20030127162116.Q80070-100000@icarus.apache.org...
>
>
> On Mon, 27 Jan 2003, Januski, Ken wrote:
>
> > Date: Mon, 27 Jan 2003 18:03:15 -0500
> > From: "Januski, Ken" <kj...@phillynews.com>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> > To: Tomcat Users List <to...@jakarta.apache.org>
> > Subject: Where does request.getServerName get name from?
> >
> > I know this is a simple question but just can't find the answer. I have
two
> > instances of Tomcat running on one server. Each has a login page as the
> > entry point and that page includes a choice of databases. I'd like the
> > default database (i.e. one at top of select list) to be determined by
> > request.getServername(). The problem I'm having is that I'm getting a
name
> > for one IP address and and IP address for the other. I can't figure out
why
> > the second one won't give me a name. I can live with the IP address but
I'd
> > prefer to get a name instead. Can anyone shed any light on where
> > request.getServerName() gets its name from?
> >
>
> It depends very much on the precise configuration and Tomcat version
> you're running.  For standalone Tomcat 4.1.x running the Coyote HTTP/1.1
> connector, it comes from the "host" header included with the request,
> which in turn comes from your browser based on the URL you submitted to.
>

Without looking, it should be the same answer for the Coyote Jk2
Apache/IIS/iPlanet Connector.  If it's not, then the bugs-that-never-die
hall-of-fame has just elected it's new queen ;-).

> > I should add that the server name is in DNS correctly and enable lookups
is
> > set to true.
> >
> > Thanks for any info.
> >
>
> Craig




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Where does request.getServerName get name from?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 27 Jan 2003, Januski, Ken wrote:

> Date: Mon, 27 Jan 2003 18:03:15 -0500
> From: "Januski, Ken" <kj...@phillynews.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Where does request.getServerName get name from?
>
> I know this is a simple question but just can't find the answer. I have two
> instances of Tomcat running on one server. Each has a login page as the
> entry point and that page includes a choice of databases. I'd like the
> default database (i.e. one at top of select list) to be determined by
> request.getServername(). The problem I'm having is that I'm getting a name
> for one IP address and and IP address for the other. I can't figure out why
> the second one won't give me a name. I can live with the IP address but I'd
> prefer to get a name instead. Can anyone shed any light on where
> request.getServerName() gets its name from?
>

It depends very much on the precise configuration and Tomcat version
you're running.  For standalone Tomcat 4.1.x running the Coyote HTTP/1.1
connector, it comes from the "host" header included with the request,
which in turn comes from your browser based on the URL you submitted to.

> I should add that the server name is in DNS correctly and enable lookups is
> set to true.
>
> Thanks for any info.
>

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>