Reverse-Proxying mod_proxy_core
I just added and commited the header rewriting support for mod_proxy_core.
$HTTP["url"] =~ "^/proxyme(/|$)" {
proxy-core.balancer = "round-robin"
proxy-core.protocol = "http"
proxy-core.backends = ( "en.wikipedia.org" )
proxy-core.rewrite-response = (
"Location" => ( "^http://en.wikipedia.org/(.*)" => "http://127.0.0.1:1025/proxyme/$1" ),
)
proxy-core.rewrite-request = (
"_uri" => ( "^/proxyme/?(.*)" => "/$1" ),
"Host" => ( ".*" => "en.wikipedia.org" ),
)
}
wget is happy now and follows redirect through the proxy as expected:
$ wget http://127.0.0.1:1025/proxyme/
--15:18:20-- http://127.0.0.1:1025/proxyme/
=> `index.html.1'
Connecting to 127.0.0.1:1025... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://127.0.0.1:1025/proxyme/wiki/Main_Page [following]
--15:18:20-- http://127.0.0.1:1025/proxyme/wiki/Main_Page
=> `Main_Page'
Connecting to 127.0.0.1:1025... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
...
This implements ProxyPassReverse in a very generic way. ProxyPass is the same as the Host: rewrite in the request.
Everything is controlled through the URL-conditional and limits the proxying to the /proxyme/ URL.
Trackbacks
Use the following link to trackback from your own site:
http://blog.lighttpd.net/articles/trackback/1777
-
I just uploaded the 3rd pre-release of lighttpd 1.4.12: http://www.lighttpd.net/download/lighttpd-1.4.12-20060724-0947.tar.gz This pre-release should work on most platforms and it mainly got improvements for our mongrel users. A small test has sho...