The following iRule section where I’ve indicated “domain1.com” - “domain2.com” {" is not catching the domain1.com with the www. The iRule redirects perfectly fine if I exclude the www. Perhaps the stripping of the www in the beginning of the iRule is conflicting? Can anyone guide me as far as what may be missing? We’re on 11.2.1.
when HTTP_REQUEST {
if { ([HTTP::host] contains "domain1.com") } {
switch -glob [HTTP::host] {
"/" { HTTP::redirect "http://federalsoup.com" }
default { HTTP::redirect "http://federalsoup.com[HTTP::uri]" }
}
}
if { ([HTTP::host] eq "www.domain2.com") } {
switch -glob [HTTP::host] {
"/" { HTTP::redirect "http://domain2.com" }
default { HTTP::redirect "http://domain2.com[HTTP::uri]" }
}
}
Check the Host header value, set to lowercase
switch -glob [string tolower [HTTP::host]] {
"subdomain.domain2.com" {
switch -glob [HTTP::query] {
"tid=*" {
HTTP::redirect "https://domain1.com"
return
}
"fid=*" {
HTTP::redirect "https://domain2.com"
return
}
"c=*" {
HTTP::redirect "https://domain3.com"
return
}
}
}
This is what's not working - www.domain1.com or www.domain2.com
"*domain1.com" - "*domain2.com" {
switch -glob [string tolower [HTTP::uri]] {
"/2013" {
HTTP::redirect "https://domain.com/something"
return
}
"/2014" {
HTTP::redirect "https://domain.com/something1"
return
}
"/2015" {
HTTP::redirect "https://domain.com/something3"
return
}
}
}
}
}