RSpangler_17032
Mar 06, 2017Nimbostratus
Remove ports from URL's
Hello,
I have the following iRule and it works as expected;
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"www.company.com" { pool company.com_www }
"www2.company.com" { pool company.com_www2 }
"www3.company.com" { pool company.com_www3 }
"www4.company.com" { pool company.com_www4 }
}
}
Now we started using mulsoft and it add the port to the url
Ex: www.company.com:443
This now breaks the above iRule and site are no longer found. I want to do something like contains
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] { contains
"www.company.com" { pool company.com_www }
"www2.company.com" { pool company.com_www2 }
"www3.company.com" { pool company.com_www3 }
"www4.company.com" { pool company.com_www4 }
}
}
the F5 gives this error:
Exception caught in LocalLB::urn:iControl:LocalLB/Rule::modify_rule()
Exception: Common::OperationFailed
primary_error_code : 17236305 (0x01070151)
secondary_error_code : 0
error_string : 01070151:3: Rule [/Common/TEST_MULSOFT] error: /Common/TEST_MULSOFT:4: error: [undefined procedure: www.company.com][www.company.com]
/Common/TEST_MULSOFT:5: error: [undefined procedure: www2.company.com][www2.company.com]
/Common/TEST_MULSOFT:6: error: [undefined procedure: www3.company.com][www3.company.com]
/Common/TEST_MULSOFT:7: error: [undefined procedure: www4.company.com][www4.company.com]
And when I try this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] contains {
"www.company.com" { pool company.com_www }
"www2.company.com" { pool company.com_www2 }
"www3.company.com" { pool company.com_www3 }
"www4.company.com" { pool company.com_www4 }
}
}
The F5 give this as an error:
Exception caught in LocalLB::urn:iControl:LocalLB/Rule::modify_rule()
Exception: Common::OperationFailed
primary_error_code : 17236305 (0x01070151)
secondary_error_code : 0
error_string : 01070151:3: Rule [/Common/TEST_MULSOFT] error: /Common/TEST_MULSOFT:4: error: [undefined procedure: www.company.com]["www.company.com" { pool company.com_www }]
/Common/TEST_MULSOFT:5: error: [undefined procedure: www2.company.com]["www2.company.com" { pool company.com_www2 }]
/Common/TEST_MULSOFT:6: error: [undefined procedure: www3.company.com]["www3.company.com" { pool company.com_www3 }]
/Common/TEST_MULSOFT:7: error: [undefined procedure: www4.company.com]["www4.company.com" { pool company.com_www4 } ]
How can I strip off the :443 from the URL so that the iRules work?
I thank you in advance for your time and help.