Forum Discussion
Nov 03, 2006
You could use a class along with the matchclass command (look in the wiki for an example on that one). Or you could use a switch statement if you want all the domains within your iRule and not externalized in a class
when HTTP_REQUEST {
switch [HTTP::host] {
"www.test.com" -
"test.com" -
"www.xyz.com" -
"xyz.com" - {
HTTP::redirect "http://primary.com[HTTP::uri]"
}
}
}
Remove the "[HTTP::uri]" from the redirect if you don't want to carry on the original request with the redirect.
If you have many addresses, it might be simpler to add them all to a class and use the matchclass command to search the class for the given host.
-Joe