Forum Discussion

TC__Wolsey_1123's avatar
TC__Wolsey_1123
Icon for Nimbostratus rankNimbostratus
Jul 11, 2005

Compound expression argument to redirect?

I am having a problem passing a compound expression to 'redirect to' ie:

 

 

if (http_uri starts_with "/this") {

 

redirect to "http://server.name/that + getfield(http_uri, '?', 2)"

 

}

 

 

The rule is accepted but the redirect is returned as the literal string 'http://server.name/that + getfield(http_uri, '?', 2)'.

 

 

Is there a way to force the evaluation of the getfield() and concat operator before the expression is handed to the redirect? I have tried various syntax surrounding the expression (I tried parentheses, curlies and nested double quotes). All these return the literal or come up with a parse error.
  • Martin_Machacek's avatar
    Martin_Machacek
    Historic F5 Account
    The corect syntax is:

    
    if (http_uri starts_with "/this") {
     redirect to "http://server.name/that" + getfield(http_uri, '?', 2)
    }

    Note that there are no quotes around the call to getfield.