[phplib] redirect in session.inc From: Steffen Uhlig (Steffen.Uhlig <email protected>)
Date: 04/07/01

Hi,

I'm maintaining a server which lives behind a firewall and is accessible
only via a forwarding proxy. The proxy machine holds all the public
addresses and forwards requests to the respective internal machine:

             +---------+ +-------------+
   World <=> | foo.com |<-------->| 192.168.0.1 | foo.local
             | bar.com |<---\ +-------------+
             +---------+ \ +-------------+
                              +-->| 192.168.0.2 | bar.local
                                  +-------------+

So foo.local answers requests for foo.com, its SERVER_NAME (Apache config)
is set to "foo.com". The same applies for bar.local/com.

Now I'm having a problem on the private machines with PHPLIBs redirect
statement. After setting the cookie PHPLIB requests in session.inc the
following redirect:

    header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());

But $HTTP_HOST points to the server's internal address (foo.local) which is
not accessible from the outside world so this redirect will fail. However,
the cookie was set successfully and the next time the user tries to access
the page the cookie is already set and there is no need for the (not
working) redirect.

I had success with using $SERVER_NAME instead of $HTTP_HOST in the above
line. $SERVER_NAME is of course set to the official address "foo.com". That
way the redirect works fine.

Is this workaround correct? Does it any harm to PHPLIBs functionality? (I
haven't found any yet). Or do I need another Apache setup? Unfortunately I
have no access to the proxy machine, all I can change is foo.local's setup.

The internal machines are running Apache 1.3.12 with PHP 4.0.1pl2 on Linux
2.2.13.

TIA

Steffen

-- 
http://steffen-uhlig.de/

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>