httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wortham" <djwort...@gmail.com>
Subject Re: determining if browser is on same machine as server
Date Thu, 10 May 2007 01:28:39 GMT
Sam,
   From what I know, which is not much, a server name could be any ID given
to a computer.  It could be an IP, it could be a domain or "sub"domain, or
it could be any ID defined in a /etc/hosts or equivelent (which would only
have to be defined on the visitor's computer).  I believe this value is
defined to be whatever your VirtualHost is defined to be.  There could be
ServerAliases which resolve better than the actual servername.

   You can try a local getbyhostname() (which may be OS-dependent an/or
deprecated) or something similar, but there is no gurantee you will get a
good reverse-IP-lookup resolve.  Try searching the web for "man
getbyhostname".  You may need to find something newer to handle IPv6
addresses (if that is a concern).

   It is true that when a visitor uses "localhost" to access a webserver, it
is translated into "127.0.0.1" (I believe on both sides).

   I know it's not the best and most definitive answer, but I hope it helps
a little.

Dave



On 5/9/07, Sam Carleton <scarleton@miltonstreet.com> wrote:
>
> I am working on the access to my kiosk system, one condition I need to
> handle in a unique way is when a web browser is run on the same
> physical machine as Apache.  It is obvious when using localhost or
> 127.0.0.1.  But when the URL is the machine name, I seem to be getting
> an IP address.  I do see in r->server->server_hostname, is there any
> way to convert that into the IP address?
>
> Sam
>



-- 
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
(408) 338-8863

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