Need some assistance with IRULE. If my pool mobileqa goes down need to seend a redirect for browser traffic to maintenance page. However if the traffic is coming from a mobile device the URL is different then a browser send a http status code 404 Not sure how to code the logic in one IRULE
URL will be something like Browser mobilet.test.com/www/ * redirect to https://edepositqa.test.com/mobile/index.html Browser mobile.test.com/splash/ * redirect to maintenace site redirect https://edepositqa.test.com/mobile/index.html Mobile Device mobile.test.com/webapp/ * send status code 404
Sample when HTTP_REQUEST { if { [active_members Mobile-QA] < 1 } { HTTP::respond 404 Location [HTTP::header Location] } }
when HTTP_REQUEST { if { [active_members Mobile-QA] < 1 } {
HTTP::redirect "https://edepositqa.test.com/mobile/index.html"
return
} } I have this IRULE Not sure how to code these in one IRULE nested
if { [HTTP::URI] starts_with “/www/” } { HTTP::redirect https://edepositqa.test.com/mobile/index.html return } elseif { [HTTP::URI] starts_with “/splash/”} { HTTP::redirect https://edepositqa.test.com/mobile/index.html return } else { HTTP::respond 404 Location [HTTP::header Location] return }
This should do the trick
Your redirect should probably use code 302. 404 means not found, and isn’t necessarily appropriate in this case.
I need to add the condition the Virtual server pool goes down as the condition
when HTTP_REQUEST { if { [active_members Mobile-QA] < 1 } {
Not sure how to incorporate the rest
if { [HTTP::URI] starts_with “/www/” } { HTTP::redirect https://edepositqa.test.com/mobile/index.html return } elseif { [HTTP::URI] starts_with “/splash/”} { HTTP::redirect https://edepositqa.test.com/mobile/index.html return } else { HTTP::respond 404 Location [HTTP::header Location] return }
nitass
February 23, 2014, 9:27am
5
e.g.
when HTTP_REQUEST {
if { [active_members Mobile-QA] < 1 } {
if { [HTTP::URI] starts_with "/www/" } {
HTTP::redirect "https://edepositqa.test.com/mobile/index.html"
} elseif { [HTTP::URI] starts_with "/splash/"} {
HTTP::redirect "https://edepositqa.test.com/mobile/index.html"
} else {
HTTP::respond 404
}
}
}
e.g.
when HTTP_REQUEST {
if { [active_members Mobile-QA] < 1 } {
if { [HTTP::URI] starts_with "/www/" } {
HTTP::redirect "https://edepositqa.test.com/mobile/index.html"
} elseif { [HTTP::URI] starts_with "/splash/"} {
HTTP::redirect "https://edepositqa.test.com/mobile/index.html"
} else {
HTTP::respond 404
}
}
}
Thank you. when I tried that IRULE received error undefined procedure error. 01070151:3: Rule [/Common/test] error: line 3: [undefined procedure: HTTP::URI] [HTTP::URI]
Thank you. when I tried that IRULE received error undefined procedure error. 01070151:3: Rule [/Common/test] error: line 3: [undefined procedure: HTTP::URI] [HTTP::URI]