Forum Discussion
hooleylist
Sep 26, 2008Cirrostratus
Do all of the domains you're redirecting to resolve to the VIP which this rule is running on? From your last post, it sounds like they don't. But if they do, you'll get constant redirect loops unless you check the host and the URI. Perhaps you want to add a check to see if the URI is not / and then redirect for the switch cases where you're redirecting to /.
Below is a correctly formatted switch example. For details on switch, you can check the DC wiki page (Click here) or the TCL man page (Click here). I added log statements to the first couple of switch cases. If the rule doesn't work as you expect, you can add logging to each case to see what's being triggered.
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New HTTP request to [HTTP::host][HTTP::uri]"
switch -glob [string tolower [HTTP::host]] {
"*newlifepubs.com" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched 1"
HTTP::redirect "http://www.example.com/nlp"
}
"*mpd.example.org" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched 2"
HTTP::redirect "http://staffweb.example.org/mpd/index.aspx"
}
"*staffweb.org" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched 3"
HTTP::redirect "http://staffweb.example.org/"
}
"staff.example.org" {
HTTP::redirect "http://staffweb.example.org/"
}
"myspam.example.org" {
HTTP::redirect "https://spam.example.com/"
}
"cars.example.org" {
HTTP::redirect "http://cds.example.org/carschoose.asp"
}
"*movementseverywhere.example.org" -
"*movementseverywhere.example.net" -
"*movementseverywhere.example.com" {
HTTP::redirect "http://www.example.org/"
}
default {
log local0. "[IP::client_addr]:[TCP::client_port]: No match"
discard
}
}
}
Aaron