For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

mikey_webb's avatar
Aug 08, 2014

irule for persistent

Please help. I have a Virtual Server with 4 pool members and simply want a user to connect to the same member ie cookie persistence. Need cookie as within the application when upload is done a new session gets created which breaks it. I'm looking at a universal persistence cookie with an irule. I am advised all requests to the app have "qarpc" in it, would the below work for the irule part of an universal persistence cookie

 

when HTTP_REQUEST { if { [HTTP::header exists "qarpc"] } { persist uie [HTTP::header "qarpc"] } }

 

10 Replies

  • You may be interested by following commands :

     

    persist uie [HTTP::cookie value "qarpc"]

     

    or

     

    persist uie [HTTP::header value "qarpc"]

     

    BR

     

    Yann

     

  • Thanks but still having an issue with the session being on the same pool member perhaps there is another way to achieve my original request?

     

  • Exact, Still missing the following rule to add the cookie persistence :

    when HTTP_RESPONSE {
      if { [HTTP::cookie exists "qarpc"] } {
        persist add uie [HTTP::header value "qarpc"]
      }
    }
    when HTTP_REQUEST {
      if { [HTTP::cookie exists "qarpc"] } {
        persist uie [HTTP::header value "qarpc"]
      }
    }
    
  • thanks for response but still having an issue with this. perhaps there is an easier way to do this? the issue again is i have an app that load balances, within the app a client can upload at this point it seems to create a new session and breaks because not on same pool member - when the client is talking to the app whether normal or upload there hhtp header will always have the value qarpc in it

     

  • within the app a client can upload at this point it seems to create a new session and breaks because not on same pool member - when the client is talking to the app whether normal or upload there hhtp header will always have the value qarpc in it

     

    are you using oneconnect? if not, can you try?

     

  • not using oneconnect and not familiar with it - but will read up if that is a solution

     

  • oneconnect does not seem to guarantee a client will always hit the same pool member which has to happen for this app to work - as the upload effectively creates a new session

     

  • When does qarpc change? You need to study the logging of the qarpc cookie and see when it changes as a file transfer occurs. The F5 will always persist back to the same pool member if the cookie matches.

    Logging is the key to solving your problem. You need to watch the cookie behaviour throughout a session. This will help you.

    when CLIENT_ACCEPTED {
      set cid [expr {int (rand() * 100000)}]
      log local0. "\[$cid\] Connection opened."
    }
    when CLIENT_CLOSED {
      log local0. "\[$cid\] Connection closed."
    }
    when HTTP_REQUEST {
      set rid [expr {int (rand() * 100000)}]
      log local0. "\[$cid:$rid\] URI = [string range [HTTP::uri] 0 50]..."
      if {[HTTP::cookie exists qarpc]} {
        log local0. "\[$cid:$rid\] Cookie qarpc = [string range [HTTP::cookie qarpc] 0 50]..."
      } else {
        log local0. "\[$cid:$rid\] No Cookie qarpc Found In Request"
      }
    }
    when HTTP_RESPONSE {
      if {[HTTP::cookie exists qarpc]} {
        log local0. "\[$cid:$rid\] Response Cookie qarpc = [string range [HTTP::cookie qarpc] 0 50]..."
      }
    }