Forum Discussion
jaddie_85451
Nimbostratus
Feb 15, 2017iRule syntax
Good morning
I am a novice at iRules and am having some issues with syntax of this iRule, this is the error I am getting in the iRules editior, any suggestions or help would be appreciated.
when HTTP_REQUEST {
if { ( [class match [string tolower [HTTP::header User-Agent]] contains useragentstoredirect]) }{
HTTP::redirect "https://xyz.sharepoint.com/Help/Pages/Supported-Browsers.aspx"
} else {
set redirect_path [URI::encode(“https://xyz.sharepoint.com[HTTP::uri]”)]
HTTP::respond 302 Location “https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=xyz.com&wreply=$redirect_path“
}
}
Exception: Common::OperationFailed
primary_error_code : 17236305 (0x01070151)
secondary_error_code : 0
error_string : 01070151:3: Rule [/Common/iRuler_Parse_Test_Rule] error: /Common/iRuler_Parse_Test_Rule:1: error: [braces are required around the expression][when HTTP_REQUEST {
if { ( [class match [string tolower [HTTP::header User-Agent]] contains useragentstoredirect]) }{
HTTP::redirect "https://xyz.sharepoint.com/Help/Pages/Supported-Browsers.aspx"
} else {
set redirect_path [URI::encode(“https://wegmans.sharepoint.com[HTTP::uri]�)]
HTTP::respond 302 Location “https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=xyz.com&wreply=$redirect_path“
}
- Vijay_E
Cirrus
I am not near my F5 to test it but I would recommend the following:
-
Remove the () brackets from the if-statement.
-
Add a blank space between }{ at the end of the if-statement.
-
Check URI encode syntax.
-
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects