Forum Discussion
Stanislas_Piro2
Aug 06, 2015Cumulonimbus
Hi, little change of the irule with:
- it's better to convert HTTP:host to lowercase before string evaluation
.
HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"mysite.mynet.com" {
HTTP::respond 302 location "https://mynew.mynet.com[HTTP::uri]"
}
"mysite2.mynet.com" {
HTTP::respond 302 location "https://mynew2.mynet.com[HTTP::uri]"
} default {
return
apply no redirect
}
}
}
What was wrong in the first iRule:
- if you evaluate a lowercase string with uppercase string... it will never match 🙂
- the hostname never start with "\"