txforward, a transparent reverse proxing extension
- Makes reverse-proxing (web accelerator) totally invisible for php
applications. Doesn't require php code modifications to handle
X-Forwarded-IP.
- Stills allows proxy-aware applications to work with X-Forwarded
headers and proxy IP
address.
- Should work with any web server
- Should work with any proxy server (but is primary squid targeted)
Download package (Current version 1.06):
From version 1.02, it is directly integrated into PHP
pecl's cvs.
To install it, just type:
pecl install txforward
Or directly download the source and run the manual
configuration steps below:
cvs -d :pserver:cvsread@cvs.php.net:/repository/pecl/txforward checkout
txforward
Configuration:
phpize
./configure --enable-txforward
make
make install
Then edit your php.ini to load the txforward.so module
extension=txforward.so
If you're chaining proxies, you can specify proxy depth in your php.ini.
For exemple for 3 chained proxies:
CLIENTS <-> RPROXY1 <-> RPROXY2 <-> RPROXY3 <-> WEBSERVER
depth 4 3 2 1 0
Just add:
[txforward]
txforward.depth = 4
This will look for the IP that is in position 4 behind the 3 chained
proxies.
In case of misconfiguration, it always falls back to a depth of 0.