pponte
Jun 12, 2017Altostratus
Switch option always matches on default
Hello everybody. I have one question which probably for some people should be something simple, but I have spent a few days on a lab environment and studying a lot, with no succesfull results. I need to do a previous check to send a path which starts with /pf to a pool, but always goes to the default pool. The first or second part is working, but I can't make it work together.
This is the iRule:
when HTTP_REQUEST
{
if {[string tolower [HTTP::uri]] starts_with "/pf" }
{
HTTP::uri [string map {"/pf/" "/PF/"} [HTTP::uri]]
pool Pool_apache_lab
}
switch -glob [string tolower [HTTP::path]] {
"default" { HTTP::respond 200 content {
Default switch
}
}
}
}
Mandatory is not to touch "switch -global", but for the first match, I can use a "global", "if", "else if" or anything you suggest.
Thanks in advance.