Forum Discussion

bsdpruegelknabe's avatar
bsdpruegelknabe
Icon for Nimbostratus rankNimbostratus
May 31, 2010

Naging "command is not valid" by persist

Hello,

 

I try to create an iRule who set a persistence due to an GET-Request-String named "id=XXXXXXXX".

 

 

Here is the rule:

 

---

 

when HTTP_REQUEST {

 

set sess [findstr [string tolower [HTTP::uri]] "id=" 8 ";"]

 

 

if { $sess != "" } {

 

persist add uie $sess

 

pool http

 

} else {

 

pool http member 192.168.10.10:80

 

}

 

}

 

---

 

 

A rule with nearly the same works. But this one keeps barfing with the following error:

 

line 5: [command is not valid in current event context (HTTP_REQUEST)] [persist add uie $sess

 

 

What did I wrong on this one?

 

(OS: 9.4.7)

 

 

 

TIA,

 

bsdpruegelknabe

 

  • Hi

     

    Have you tried "persist use $sess" instead.

     

     

    I hope this helps

     

     

    Bhattman

     

     

     

  • Hello,

     

     

    With persist uie "$sess" it works. (At least I don't get an error message.) Thanks for the hint.

     

     

    So I don't need to add an persistence entry?

     

    As result I need that all requests with eg. "id=1234" goes to Member1 and with "id=2345" goes to Member2 and so on... where the numbers are an alphanumeric String.

     

     

     

    cu,

     

    bsdpruegelknabe

     

  • Hi,

     

    The only time you need "add" entry is when load balancing server is known. In this case you were using before that happened which caused the issue.

     

     

    Bhattman