Forum Discussion
Allen_Ingram_39
Nimbostratus
Feb 27, 2007Migrating Redirects from CSS with Irule
We are in the process of migrating various redirects to the F5 from our legacy CSS'es. They are about 20 independant redirects pointing to various IP's but all the redirects are a part of www.h...
hoolio
Cirrostratus
Feb 28, 2007If you have more than a couple of cases to check, you could use the switch command:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
*example.com -
*site1.example.net -
*site2* {
HTTP::redirect "http://host1.example.com"
}
*site3* -
*site4* {
HTTP::redirect "http://host2.example.com"
}
default {
HTTP::redirect "http://host3.example.com"
}
}
}You can check the iRules wiki page for switch for details on this (Click here)
If you want to debug this, you could add log statements and check the /var/log/ltm log file. Here's an example for logging:
log local0. "client: [IP::client_addr] matched first switch case"
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