Forum Discussion

Jonas_Karlsson1's avatar
Jonas_Karlsson1
Historic F5 Account
Mar 02, 2005

Help with persist command

I need some help with the persist command. It's been a long day so I'm probably not thinking straight anymore.

 

 

I have an IP address and a string and when I find the same string in another HTTP request I want to send that to the IP address I have.

 

 

Could someone please point me in the right direction?

 

 

Thanks!
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Are you asking to persist on both the IP address and the string together?

    If so, simply use UIE persistence and concatenate the two together like so:

     
     rule my_uie { 
        when HTTP_REQUEST { 
           persist uie [concat [IP::remote_addr] [HTTP::header "MyHeader"]] 
        } 
     } 
     

  • Jonas_Karlsson1's avatar
    Jonas_Karlsson1
    Historic F5 Account
    I should probably have explained a bit more in depth what I'm trying to do.

     

     

    I have two pools of serves. Server A in one pool does a POST to the other pool. The reply (from server B), will contain a unique identifier. Later on server B will post a message back saying that it is done with processing the message. I want that (based on the same unique identifier), to persist back to server A. It's a bit backwards...
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Ok, this is an excellent example for using the session cmd.

     

     

    First, you will want to extract the unique Identifier and on the first request do a "session add uie $unique_id [IP::client_addr]" to save the original host that was used.

     

     

    Then when the successive posts comes in, you'll want to extract the unique identifier, look it up in the session table with "session lookup uie $unique_id" and if it contains a value, use that host with either the "pool member " or the "node " command.