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

jan_de_wachter_'s avatar
jan_de_wachter_
Icon for Nimbostratus rankNimbostratus
Feb 25, 2014

How assign a non-default persistence profile in an irule?

We are using a virtual server for HTTP.

 

We do selection of pool based on HOST using irule. If sicky persistence is needed we set the persistence to source-addr.

 

Now we would like to set mirror persistence for some selections. How can we do this - or how can we assign a non-default persistence profile to a specific entry (using irules).

 

Thanks

 

6 Replies

  • you can use something like this:

    when HTTP_REQUEST {
     Check the requested URI
    switch -glob [HTTP::uri] {
      "/abc.com/*     {
         pool abc_pool
         persist source_addr 0
      }
      default {
         pool defaul_pool
      }
    }
    }
    
  • OK. This is the way I am doing it, but I would add mirror persistence. The persist only admits the persistence type mask and time. I don't know how to set the mirror. I only see it by creating a new persistence profile, but how assign it to a specific case??

     

  • It depends on, what is "specific case" for you? Is it source address, url? Yes, for mirroring you need a new persistence profile (I didn't find how to do that in aanother way).

     

  • Yes that is what I supposed to do. But I don't want to select this "new" profile in all cases. Mostly I even don't need sticky (persist none), but in other cases (same virtual server) I need persist source-address and sometimes source-address with mirror persist.

     

    How can I realize this in 1 irule?

     

  • when HTTP_REQUEST {
     if { [HTTP::uri] equals "/admin" } { 
      pool your_pool
    persit source_add_mirroring 0
     } } elseif {[IP::client_addr] equals "192.168.5.43" } {
      pool your_pool
    pesist source_add 0
    } else {
    pool default_pool
     }
    } 
    
  • When I write a persist "ownname" I get following error message (with irule GUY): 01070151:3: Rule [/Common/testjdw] error: /Common/testjdw:16: error: [badoption][source_addr_mirroring]

     

    my code: when HTTP_REQUEST {

     

    switch -exact "[string tolower [HTTP::host]]" {
        "acc-search.infrabel.be"           { persist none }
        "acc-mediaservice.infrabel.be"     { persist source_addr 255.255.255.255 180}
        "acc-my.infrabel.be"               { persist source_addr_mirroring 0 }
        "acc-officeweb.infrabel.be"        { persist source_addr 255.255.255.255 180}
        default                            { pool $default_pool }
    }

    }

     

    and I defined source_addr_mirroring as a new persistence profile

     

    Any idea??