Forum Discussion
Nathan_67700
Nimbostratus
Jan 31, 2012Multiple path and pool definitions
I have looked all over and found things close to this but not quite in line with what I'm trying to accomplish and forgive me because I've done very few iRules in my time. Here is what I'm trying to ...
hoolio
Cirrostratus
Jan 31, 2012Hi 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
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects