REMOTE_ADDR Weirdness

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: R Melder at SPiN Internet Media
Date:  
Subject: REMOTE_ADDR Weirdness
Given: http://vhostA/testq.php?q=http://vHostB/test.php

If your objective is for vHostB to get the REMOTE_ADDR of the browser, then
pass it in your URL like:

$url = $q . "?remote_addr=" . $REMOTE_ADDR;
Then do your fopen() stuff.

; ) .randy

..:: Randy Melder ::..
602-279-0135 - www.spininternetmedia.com





-----Original Message-----
From:
[mailto:plug-discuss-admin@lists.plug.phoenix.az.us] On Behalf Of Phil
Mattison
Sent: Thursday, June 12, 2003 2:59 PM
To:
Subject: Re: REMOTE_ADDR Weirdness


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 -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

--
Bryce C <>
CoBryce Communications
----- Original Message -----
From: Bryce C <>
To: PLUG <>
Sent: Thursday, June 12, 2003 2:32 PM
Subject: Re: REMOTE_ADDR Weirdness



---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss