Forum Discussion
dlegate_23320
Nimbostratus
Mar 09, 2012iRule to Migrate to new server based on URL (directory) text?
Can iRules direct requests to a specific server/s based on text in the URL?
Scenario:
We have an old production server (physical) that is NOT load balanced.
We have new v...
hoolio
Cirrostratus
Mar 09, 2012Hi Dan,
If all of the content for each application is under a single directory, this should be really simple to implement using a switch statement in an iRule. Here's an example. As you want to move new apps to a separate pool, just add the path to the switch statement and point it to a new pool
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/app1*" {
pool app1_pool
}
"/app2*" {
pool app2_pool
}
default {
pool default_pool
}
}
}
Or if all of the new servers have the code for all of the URIs, you could combine the switch cases to point to a single new pool:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/app1*" -
"/app2*" -
"/app3*" {
pool app2_pool
}
default {
pool default_pool
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
