VSE_113287
Aug 13, 2015Nimbostratus
iRule- Need syntax help
What's wrong with this iRule syntax in BIG-IP version 10.2.4
when HTTP_REQUEST { if {HTTP::path starts_with "/PasswordVault/auth/rsa"}{ HTTP::respond 301 Location "/" } }
What's wrong with this iRule syntax in BIG-IP version 10.2.4
when HTTP_REQUEST { if {HTTP::path starts_with "/PasswordVault/auth/rsa"}{ HTTP::respond 301 Location "/" } }
The correct syntax is:
when HTTP_REQUEST {
if { [HTTP::path] starts_with "/PasswordVault/auth/rsa" } {
HTTP::respond 301 Location "/"
}
The missing part is the substitution operator (the square brackets) enclosing HTTP::path. Generally, when you want a command to retrieve a value that you will use, you enclose the command in the square brackets. Contrast, in your code, HTTP::path with HTTP::respond. With the former, you want the value (to use as the left operand of the starts_with operator). With the latter, you want the command to take an action, but do not need to capture the result (because there isn't one).