REMOTE_ADDR Weirdness

Phil Mattison plug-discuss@lists.plug.phoenix.az.us
Thu, 12 Jun 2003 14:58:40 -0700


But I'm not seeing the address of eth0. I have a separate eth0:n for each
vHost. The REMOTE_ADDR I'm seeing is the correct one for the vHost, but not
for the remote vHost.

Here are the scripts if you're just dying to see for yourself:

test.php
--------
<?
echo "<pre>";
while(list($k,$v) = each($HTTP_SERVER_VARS))
{
 echo "[".$k."] = ".$v."\n";
}
echo "</pre>";
?>

testq.php
----------
<?
echo "<pre>";
if(!$q)exit();
echo $q."\n";
$fp = fopen($q, "r");
if($fp)
{
 $response = "";
 while(!feof($fp))$response .= fgets($fp, 96);
 fclose($fp);
}
echo $response;
echo "</pre>";
?>

Use them like this:
http://vhostA/testq.php?q=http://vHostB/test.php

--Phil M.
--------------------------------
Yes, auto routing by linux. Go out the most direct route, short of
calling 127.0.0.1. I have a similar setup and if I don't go out to the
router from eth0 first, it'll go out on eth0:0 to eth:0's address.

On Thu, 2003-06-12 at 14:25, Phil Mattison wrote:
> Here's a brain teaser for you guys. I'm using the PHP fopen() function
with
> Linux/Apache to read HTTP data from one web server to another (not all
that
> unusual as I understand). REMOTE_ADDR is supposed to have the IP address
of
> the requestor when the responding server script runs, and it usually does,
> except when both web servers are virtual hosts on the same physical
server,
> in which case REMOTE_ADDR is the same as SERVER_ADDR (not good). I've
tried
> it on three different virtual host systems, all with the same result.
> Twilight Zone, anyone?
> --
> Phil Mattison
> Ohmikron Corp.
> 480-722-9595 ext. 1
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
--
Bryce C <Plug@BryceCo.Net>
CoBryce Communications
----- Original Message -----
From: Bryce C <Plug@BryceCo.Net>
To: PLUG <plug-discuss@lists.PLUG.phoenix.az.us>
Sent: Thursday, June 12, 2003 2:32 PM
Subject: Re: REMOTE_ADDR Weirdness