- Try putting * after each switch arm clause - just in case you have say :443 appended to the end
- Add 'return' after HTTP::respond (best practise inncase you have other iRule statements after the switch)
- Add logging statements in
Updated iRule;-
when HTTP_REQUEST {
log local0. "[HTTP::host] on port [TCP::local_port]"
switch -glob [string tolower [HTTP::host]] {
"domain1.com*" -
"domain2.com*" -
"www.domain1.com*" -
"www.domain2.com*" {
log local0. "redirecting"
HTTP::respond 301 Location "https://www.mymainsite.com"
return
}
}
}