Forum Discussion

Brad_Kloch_1032's avatar
Brad_Kloch_1032
Icon for Nimbostratus rankNimbostratus
Oct 26, 2006

iRule for fallback persistence

I'm trying to create an iRule that will modify the source_addr so that our fallback persistence will work using Akamai. Akamai does pass over the user's IP address in the request in a header named "True-Client-IP". I'd like to use this header to replace the source_addr so that fallback persistence will work.

 

 

I've started the following iRule but I'm not sure if it's even possible to change the source_addr.

 

 

Any help would be greatly appreciated.

 

 

when HTTP_REQUEST {

 

if { [HTTP::header exists "True-Client-IP"] } {

 

log "Client-IP: [IP::remote_addr]"

 

set client_ip [HTTP::header "True-Client-IP"]

 

log "True-Client-IP: [IP::client_addr]"

 

}

 

}

1 Reply

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    You can change the sourceIP with a SNAT, but it would be changed on egress. Simple persistence inside of LTM looks at the source address upon ingress, before any iRule processing, so that wouldn't solve your problem.

     

     

    You'll need to include both persistence methods in your iRule.

     

     

    If you search the forum for "jsessionid", you'll find some examples of iRules which use cookies if they exist, and fallback to URI parameters otherwise. I'm thinking you could modify that logic to look for whatever primary persistence token you are currently using, and if non-existent, use [HTTP::header "True-Client-IP"] as a fallback.

     

     

    HTH

     

    /deb