Forum Discussion
hooleylist
Jan 31, 2012Cirrostratus
Hi Nathan,
Here's an example which shows how you can select a pool, specific pool member or arbitrary destination IP based on the requested HTTP path. The client will not see an HTTP redirect as the request is proxied to the destination.
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"/path1*" {
Select a pool
pool path1_pool
Or select a pool member
pool app_pool member 1.1.1.1 80
Or select a node not part of a pool
node 1.1.1.1 80
}
"/path2*" {
Select a pool
pool path2_pool
Or select a pool member
pool app_pool member 1.1.1.2 80
Or select a node not part of a pool
node 1.1.1.2 80
}
default {
Select a pool
pool default_pool
Or select a pool member
pool app_pool member 1.1.1.3 80
Or select a node not part of a pool
node 1.1.1.3 80
}
}
}
If you need to rewrite the host header based on the path, you can do that in each switch case using:
HTTP::header replace Host "newhost.example.com"
If you define each node as a pool member on whatever IP:port the service listens on, LTM will translate the destination IP and port by default. Or if you use the node command you can set the destination IP and optionally the port.
Aaron