Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

How to delete an existing persistence and redirect the request to a node when a uri is matched.

RJ_171490
Nimbostratus
Nimbostratus

Hi All,

We currently have this iRule association on LTM VIP. It does a conditional check on the uri and if it meets criteria then it says to use a particular node - Node A(CMS console) else it will use the default pool. We are using source address affinity persistence with a timeout of 3600 secs for the default pool.

So the problem occurs when the admin is connected to a different pool member and wants to go to the admin console by using the url "www.mywebserver.com/cms". Once he is connected to the admin console, we see a persistence record of the earlier connection(lets say he was connected to Node B) in the persistence table (I am sure it is because of the 3600 secs timeout value) and user gets logged out frequently.

To resolve this issue, I am thinking to remove the existing persistence record when a user wants to get to CMS console or Node A and also would like the Node A to use source address affinity as its persistence method & increase its timeout to 7200 secs.

All suggestions are welcomed.

iRule we currently have:

when HTTP_REQUEST {

set http_uri [string tolower [HTTP::uri]]

if { $http_uri starts_with "/cms" } { node 172.18.32.115

} elseif { $http_uri starts_with "/util" } { node 172.18.32.115

}

} iRule i wanted to configure - Not sure of the syntax to do this if you can please help me with this.

when HTTP_REQUEST {

set http_uri [string tolower [HTTP::uri]]

if { $http_uri starts_with "/cms" } {
     to delete the existing persistence record
    persist delete source_addr [IP::client_addr]

     to use source address persistence with timeout as 7200 secs                        
    persist source_addr 7200

     and then select the CMS server                        
    node 172.18.32.115          

} elseif { $http_uri starts_with "/util" } {
    persist delete source_addr [IP::client_addr]
    persist source_addr 7200
    node 172.18.32.115            
}        

}

4 REPLIES 4

Josiah_39459
Historic F5 Account

I think you should use 'persist add' and also the same key '[IP::client_addr]' when adding. Otherwise the 'persist delete' won't find the records to delete (since they weren't added with that key). Otherwise it looks good at a glance.

 

Thank you very much for your response. Can you please let me know the exact command I should add? And where to add it in the iRule.

the syntax is here: https://clouddocs.f5.com/api/irules/persist.html

Thanks much for your prompt response! I will take a look at it and come back.