rob_carr_76748
Mar 13, 2014Nimbostratus
Error while loading iRule
Any idea why this rule loads:
ltm rule LOOKUP_LB_Policy {
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] contains HTTP_URL_RLSE_LOOKUP_Class]} {
pool HPVTIBRLSEPROXY_Farm
} elseif { [class match [string tolower [HTTP::host]] contains HTTP_URL_LOOKUP_Class]} {
pool HPVTIBPROXY_Farm
} else {
drop
}
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
if { [HTTP::header exists Location] } {
HTTP::header replace Location [string map {"http://first.domain.com" "https://first.domain.com"} [HTTP::header Location]]
}
}
}
}
while this one doesn't, with an error message "01070151:3: Rule [/Common/PROD_SSL_LB_Policy] error: /Common/PROD_SSL_LB_Policy:41: error: [braces are required around the expression][when HTTP_RESPONSE {"
ltm rule PROD_SSL_LB_Policy {
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] contains HTTP_URL_w1HBFCOMAU_Class]} {
pool HPVCMSAPP_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_GIOS_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HBFDECLARATION_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_ONLINETRAVELWEB_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_WEBFORMS_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_ONLINECLAIM_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HIOS_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HCFTRAVEL_CLASS] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_PROVIDERCENTRE_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HOSPITALADMIN_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HOSPITAL_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_MYHBF_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_HBFATHOME] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_TRAVEL-INSURANCE_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::uri]] contains HTTP_URL_DDTRAVEL_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::host]] contains HTTP_URL_MIHBFCOMAU_Class] } {
pool PROD_CMS_Farm
} elseif { [class match [string tolower [HTTP::host]] contains HTTP_BAD_URL_PROD_Class] } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
} else {
pool PROD_CMS_Farm
}
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
if { [HTTP::header exists Location] } {
if { [string tolower [HTTP::header Location]] equals “http://second.domain.com” } {
HTTP::header replace Location [string map {"http://second.comain.com.au" "https://second.domain.com.au"} [HTTP::header Location]]
} elseif { [string tolower [HTTP::header Location]] equals “http://third.domain.com.au” } {
HTTP::header replace Location [string map {"http://third.domain.com.au" "https://third.domain.com.au"} [HTTP::header Location]]
}
}
}
}
}
I've checked that there is closure on all braces and brackets, and that I'm allowed to use all of my commands in the HTTP_RESPONSE context, but after that, I'm drawing a blank.
Pardon the somewhat clunky setup, it's a configuration migration and I'm making the rule logic mirror the Cisco policy map behavior the client currently has.