Forum Discussion
hooleylist
Cirrostratus
Feb 06, 2009That's a good start. You can do pairs of replacements within string map (Click here😞
string map {find1 replace1 find2 replace2} [HTTP::uri]
You don't need the -glob flag on switch if you're not using wildcards in the switch cases. You skip the intermediate variable for $host. And HTTP::uri is cached in the event, so logging it after modifying it won't show the change.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"app.domain.com" {
log local0. "redirecting to http://www.google.com[string map -nocase {"/path_to_replace" "/new_path" "index.jsp" "index.asp"} [HTTP::uri]]"
HTTP::redirect "http://www.google.com[string map -nocase {"/path_to_replace" "/new_path" "index.jsp" "index.asp"} [HTTP::uri]]"
}
}
}
Aaron