Forum Discussion
Andy_McGrath
Apr 04, 2019Cumulonimbus
Your first iRule is the
HTTP::header
command think you need to include the key word value
in 14.
when HTTP_REQUEST {
Rewrite the User-Agent header value if it's empty
if {([string length [HTTP::header value "User-Agent"]] == 0) || !([HTTP::header exists "User-Agent"])}{
Replace the User-Agent header with a default value
HTTP::header replace "User-Agent" "Mozilla/4.0 (compatible; No User Agent Provided)"
}
}
With your second iRule looks ok other than the formatting and the perfect use case for using
switch
, give the following a try and see if this fixes the errors:
when HTTP_REQUEST {
if {([HTTP::uri] eq "/portal/") || ([HTTP::uri] eq "/")} {
switch -glob [HTTP::host] {
"URL*" {HTTP::redirect "http://www.URL.org/contact-us/contact-us.aspx"}
"path1*" {HTTP::redirect "http://www.anotherURL.com/applications/path1/contact-us.aspx"}
"path2*" {HTTP::redirect "http://www.anotherURL.com/applications/path2/contact-us.aspx"}
"path3*" {HTTP::redirect "http://www.anotherURL.com/applications/path3/contact-us.aspx"}
"path*" {HTTP::redirect "http://www.anotherURL.com/Contact-Us/Contact-Us.aspx"}
}
}
}