Forum Discussion

Bob_10976's avatar
Bob_10976
Icon for Nimbostratus rankNimbostratus
Jan 26, 2011

Possible Syntax issue with HTTP::Cookie iRule

Hello all..

I have a working iRule in place and I need add to it, but it seems I'm getting some type of Syntax error.

The current iRule looks like this and as I said appears to work fine:

 
when HTTP_RESPONSE {
if { [HTTP::cookie exists "ASP.net_SessionID"] } { 
HTTP::cookie secure "ASP.net_SessionID" enable
}
if { [HTTP::cookie exists ".ADAuthCookie"] } { 
HTTP::cookie secure ".ADAuthCookie" enable }
}

I'm simply wanting to add a third cookie reference:

 
when HTTP_RESPONSE {
if { [HTTP::cookie exists "ASP.net_SessionID"] } { 
HTTP::cookie secure "ASP.net_SessionID" enable 
}
if { [HTTP::cookie exists ".ADAuthCookie"] } {
HTTP::cookie secure ".ADAuthCookie" enable }
} 
if { [HTTP::cookie exists "RS_User"] } {
HTTP::cookie secure "RS_User" enable }
} 

When I do I get the following errors:

Line 8: [command is not valid in the current scope] [if {HTTP::cookie exist “RS_User”]}{

Line 10: [command is no valid in the current scope][}]

Am I missing something here?

Thanks,

Bob

2 Replies

  • You have an extra "}" above your final if statement. Give this a shot.

    
    when HTTP_RESPONSE {
    if { [HTTP::cookie exists "ASP.net_SessionID"] } { 
    HTTP::cookie secure "ASP.net_SessionID" enable 
    }
    if { [HTTP::cookie exists ".ADAuthCookie"] } {
    HTTP::cookie secure ".ADAuthCookie" enable 
    }
    if { [HTTP::cookie exists "RS_User"] } {
    HTTP::cookie secure "RS_User" enable 
    }
    } 
    

    That was originally there to close the HTTP_REQUEST event. Looks like an additional was was correctly created at the end of the new rule but the original wasn't removed.