httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wortham" <>
Subject Re: determining if browser is on same machine as server
Date Thu, 10 May 2007 01:31:21 GMT
  I knew I missed something.  There is a C-string containing the local_ip of
the server in the conn_rec struct.

  I believe the access from a request_rec would be r->connection->local_ip


On 5/9/07, David Wortham <> wrote:
> 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 "" (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 <> 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
> >  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

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

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