From: tedd on
At 11:54 AM -0400 8/29/10, Jason Pruim wrote:
>On Aug 29, 2010, at 10:55 AM, tedd wrote:
>>
>>To all:
>>
>>My post about SERVER globals was simply an observation that the
>>SERVER global report of host and remote was not symmetric -- for
>>example you could obtain both the IP and Domain Name of the host,
>>but only the IP of the remote. Sorry for any confusion I may have
>>caused in my post.
>
>
>Hey tedd,
>
>My understanding of how shared hosting works would make this near
>impossible... Basically Apache grabs a header that is sent at the
>initial connection which includes the destination hostname and from
>there it translates it to the proper directory on the shared host.
>
>All the IP's though are based off of the parent site's server...
>
>Now with dedicated hosting where you have the entire machine you can
>do what you are looking at because the IP address will always
>translate back to your website.
>
>Now hopefully my understanding of shared hosting isn't flawed but if
>it is I'm sure someone will nicely point out why :)


Your understanding is the same as my understanding.

Cheers,

tedd

--
-------
http://sperling.com/
From: Per Jessen on
Jason Pruim wrote:

> My understanding of how shared hosting works would make this near
> impossible... Basically Apache grabs a header that is sent at the
> initial connection which includes the destination hostname and from
> there it translates it to the proper directory on the shared host.
>
> All the IP's though are based off of the parent site's server...
>=20
> Now with dedicated hosting where you have the entire machine you can
> do what you are looking at because the IP address will always
> translate back to your website.

AFAICT, Tedd was not asking about the server, he's asking about the
client.=20


--=20
Per Jessen, Z=C3=BCrich (17.2=C2=B0C)

From: Peter Lind on
On 29 August 2010 18:04, Per Jessen <per(a)computer.org> wrote:
> Jason Pruim wrote:
>
>> My understanding of how shared hosting works would make this near
>> impossible... Basically Apache grabs a header that is sent at the
>> initial connection which includes the destination hostname and from
>> there it translates it to the proper directory on the shared host.
>>
>> All the IP's though are based off of the parent site's server...
>>
>> Now with dedicated hosting where you have the entire machine you can
>> do what you are looking at because the IP address will always
>> translate back to your website.
>

The HTTP protocol does not provide a domain among the request header
fields - you need to implement idenfication/authentication in a
different manner (preferably in a way that does not rely upon IP
addresses, seeing as that doesn't provide any reliable sort of
identification).

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>
From: Paul M Foster on
On Sun, Aug 29, 2010 at 06:04:23PM +0200, Per Jessen wrote:

> Jason Pruim wrote:
>
> > My understanding of how shared hosting works would make this near
> > impossible... Basically Apache grabs a header that is sent at the
> > initial connection which includes the destination hostname and from
> > there it translates it to the proper directory on the shared host.
> >
> > All the IP's though are based off of the parent site's server...
> >
> > Now with dedicated hosting where you have the entire machine you can
> > do what you are looking at because the IP address will always
> > translate back to your website.
>
> AFAICT, Tedd was not asking about the server, he's asking about the
> client.

No, he's talking about the server. But the server he's using may offload
the processing of a script to another machine. So

$_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME']

both relate to the server which the client is originally communicating
with. But he wants to know if he can get the same information about a
different remote server which is processing a script for him. The
problem is that we have:

$_SERVER['REMOTE_ADDR']

but no

$_SERVER['REMOTE_NAME']

So the question is, how would he get that last variable. It becomes
complicated when using a shared hosting environment, because server
names and IPs aren't a 1:1 mapping. An IP may represent numerous actual
site names. This was part or all of the reason why the http protocol was
revised from 1.0 to 1.1-- in order to accommodate all the domains, which
because of the cramped IP space of IPv4, had to share IPs. So in the
HTTP 1.1 protocol, there is additional information passed about the name
of the domain.

Paul


--
Paul M. Foster
From: Peter Lind on
On 30 August 2010 21:32, Paul M Foster <paulf(a)quillandmouse.com> wrote:
> On Sun, Aug 29, 2010 at 06:04:23PM +0200, Per Jessen wrote:
>
>> Jason Pruim wrote:
>>
>> > My understanding of how shared hosting works would make this near
>> > impossible... Basically Apache grabs a header that is sent at the
>> > initial connection which includes the destination hostname and from
>> > there it translates it to the proper directory on the shared host.
>> >
>> > All the IP's though are based off of the parent site's server...
>> >
>> > Now with dedicated hosting where you have the entire machine you can
>> > do what you are looking at because the IP address will always
>> > translate back to your website.
>>
>> AFAICT, Tedd was not asking about the server, he's asking about the
>> client.
>
> No, he's talking about the server. But the server he's using may offload
> the processing of a script to another machine. So
>
> $_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME']
>
> both relate to the server which the client is originally communicating
> with. But he wants to know if he can get the same information about a
> different remote server which is processing a script for him. The
> problem is that we have:
>
> $_SERVER['REMOTE_ADDR']
>
> but no
>
> $_SERVER['REMOTE_NAME']
>
> So the question is, how would he get that last variable. It becomes
> complicated when using a shared hosting environment, because server
> names and IPs aren't a 1:1 mapping. An IP may represent numerous actual
> site names. This was part or all of the reason why the http protocol was
> revised from 1.0 to 1.1-- in order to accommodate all the domains, which
> because of the cramped IP space of IPv4, had to share IPs. So in the
> HTTP 1.1 protocol, there is additional information passed about the name
> of the domain.
>

In the scenario painted, it's explicitly stated that one server acts
as a client in trying to access a resource on another server. Could
you enlighten me as to where the domain name of a client is located in
the request header fields? Here's the RFC for HTTP 1.1
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>