Forum Discussion

kevinmc's avatar
kevinmc
Icon for Altocumulus rankAltocumulus
Aug 24, 2017

Persistence iRule

Connections to a pool should use a non secure cookie persistence profile which I have created, unless they come from a specific list of IP addresses which need to use source address persistence

 

when CLIENT_ACCEPTED

 

{ if { [class match [IP::client_addr] equals addressrange] } { pool SF-ECRPROD persist source_addr}

 

else { pool SF-ECRPROD persist ? } }

 

How do I assign a specific persistence profile in the iRule?

 

3 Replies

  • Hi Kevinmc,

     

    If you want to use cookie insert persistence method , you can use below

     

    persist cookie insert "cookiename" expirationtime

     

  • thanks nag. How do I specify if it is a secure or unsecure cookie? This virtual server is doing SSL offload so needs to use unsecure cookie

     

  • Hi KevinMC,

    I would recommend to use a Cookie-based persistence profile (including your desired settings) as the default profile on your Virtual Server and then use an iRule to overwrite this setting for just specific SRC-IPs...

    when CLIENT_ACCEPTED { 
        if { [class match [IP::client_addr] equals addressrange] } then { 
            persist source_addr
        } else {
             Do nothing and keep the default persistence profile for this connection
        }
        pool SF-ECRPROD 
    }
    

    Cheers, Kai