Reputation: 42307
I'm trying to configure lighttpd to proxy traffic to one relative path to one proxy server, and traffic to another path to another proxy server.
For example:
http://mydomain.com/ proxies to 123.111.111.1
http://mydomain.com/apathname/ proxies to 123.111.111.2
I am flumoxed trying to figure out how to the the /apathname/ configured. This is a sample of what I have configured so far, which just directs all traffic to 123.111.111.1
$HTTP["host"] =~ "mydomain.com" {
proxy.balance = "fair"
proxy.server = (
"" =>
(
("host" => "123.111.111.1", "port" => "80" )
),
"apathname" =>
(
( "host" => "123.111.111.2", "port" => "80" )
)
)
}
My apologies if this question should be on another SO site. I'm primarily a coder, not a network guy, and I know I always get the best answers on SO itself, which is why I'm asking here.
Upvotes: 3
Views: 6430
Reputation: 6430
You need to check the request URL from $HTTP["url"]
and set up multiple proxy rules, like this:
$HTTP["host"] =~ "(www.example.com)" {
server.document-root = "/var/www/www.example.com"
$HTTP["url"] =~ "^/upload(.*)$" {
proxy.server = ("" => (
("host" => "10.2.2.1", "port" => 3000)
))
}
$HTTP["url"] =~ "^/submit(.*)$" {
proxy.server = ("" => (
("host" => "10.2.2.2", "port" => 3000)
))
}
}
In this example above:
/upload
will be proxied to 10.2.2.1:3000
./submit
will be proxied to 10.2.2.2:3000
.Upvotes: 5