Forum Discussion

C_D_18583's avatar
C_D_18583
Icon for Nimbostratus rankNimbostratus
Oct 25, 2005

Adding persistance profiles to pools using Irules

I have 2 persistance profiles that I need to apply

 

to individual pools namely jupiter_60mins and earth_30mins.

 

Since I cannot apply the persistance profiles at the pool level

 

How do I re-write this irule below to incorporate these profiles to the pools ?

 

 

Sample :

 

 

if { [HTTP::host] starts_with "nexus"} {

 

if {$uri starts_with "/jupiter/"} {

 

pool robocop-1

 

}

 

elseif {$uri starts_with "/earth/"} {

 

pool robocop-2

 

}

 

}

9 Replies

  • Assuming you set $uri elsewhere, try:

    
    when HTTP_REQUEST {
      if {[HTTP::host] starts_with "nexus"} {
        if {$uri starts_with "/jupiter/"} {
          PROFILE::persist timeout 3600
          pool robocop-1
        }
        elseif {$uri starts_with "/earth/"} {
          PROFILE::persist timeout 1800
          pool robocop-2
        }
      }
    }

    Please note, I couldn't find any docs for this, so this may not work.

    Cheers,

    Brian
  • I'm trying to do a similar function, I want to apply persistance to one pool and not the other. This rule is accepted for proper syntax but it did not work in inital testing. I still need to dig into it. I'm not sure if this is actually a valid rule.

     

     

    when HTTP_REQUEST {

     

    if { [matchclass [HTTP::uri] starts_with $::static_content] }{

     

    use pool content

     

    } else {persist cookie passive

     

    use pool proxy

     

    }

     

     

    }
  • Add logging statements to make sure you are getting the results you anticipate. Try findclass instead of matchclass since you are using the starts_with operand

     

     

  • Thanks for the input. After testing today, things are not quite working right. Every other connection attempt to the VIP using that rule causes the server in the proxy pool to generate an error (I have each pool down to using a single server). For those requests that are failing the BIG-IP is generating these error messages.

     

     

    http_process_state_prepend - Invalid action EV_INGRESS_DATA during ST_HTTP_PREPEND_HEADERS

     

     

    Some other threads on the board seem to indicate these errors are caused by the http profile, specifically header inserting and not the rule.

     

     

    For the 50% of initial requests that work, everything works fine after that for that session.

     

     

    I'll be opening a ticket in the morning.

     

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Also, don't forget you can also use "persist none" to disable persist to a particular pool (assuming you have the persistence configured with a profile on the virtual).