Forum Discussion

Ariel_Moreno_10's avatar
Ariel_Moreno_10
Icon for Nimbostratus rankNimbostratus
Aug 27, 2015

Persist connection based on HTTP::header value

Hello E'all I need an irule to persist a connection to the same pool member based on the value of an HTTP::header I took a look on devcentral and adapted to following irule to my need.

 

when HTTP_REQUEST { set Cardtoken [HTTP::header "X-Cardtoken-Id"] if { $Cardtoken eq "" } { log local0. "[IP::client_addr]:[TCP::client_port] [HTTP::uri] NO Cardtoken header" } else { persist uie $Cardtoken 60 log local0. "[IP::client_addr]:[TCP::client_port]:[HTTP::uri] Cardtoken: [HTTP::header value "X-Cardtoken-Id"], persist record: [persist lookup uie $Cardtoken]" } }

 

Taking a look to ltm log

 

Aug 27 03:23:17 DC4-LTM02 info tmm[27804]: Rule /Common/header_persist_hash2 : 10.32.174.166:54943:/xxx/cacheFetch Cardtoken: ff8080814f6dd9e3014f6e0a120300c2, persist record: Aug 27 03:23:22 DC4-LTM02 info tmm5[27805]: Rule /Common/header_persist_hash2 : 10.32.170.23:15422:/xxx/authorization Cardtoken: ff8080814f6dd9e3014f6e0a120300c2, persist record: /Common/dmz_807-pool 10.100.107.36 8443

 

There are some logs with persist records and other without it. I guess it is because it was the first connection, am I right? Any feedback would be really appreciate. Regards

 

4 Replies

  • that assumption would be correct then. The first request isn't going to have a persistence record because you haven't created one yet. I'm assuming every subsequent request has a persistence record?