Peak_10_71174
Oct 27, 2009Nimbostratus
http redirect if no path match irule
I need to create an irule that accomplishes 2 things:
When incoming http requests for data.abc.com are received on a virtual server, they are redirected to www.abc.com/data. However, when a user requests data.abc.com/file.exe directly, that http request is then directed to the server pool on the load balancer that the virtual server is associated with. Below is my first attempt at writing this rule, but I am posting it on here because I am far from an expert in writing irules.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"data.abc.com/file.exe" {
pool data_pool
log local0. "HTML hit - data_pool chosen"
}
default {
HTTP::redirect "http://www.abc.com/data"
log local0. "redirect_chosen."
}
}
}
I used the switch command in this attempt, but I am in no way certain that this is the best way to accomplish this.