Forum Discussion

Abhilash_Paul_2's avatar
Abhilash_Paul_2
Icon for Nimbostratus rankNimbostratus
Aug 28, 2017

Enable source IP persistence based on X forwarded IP info

I am looking to enable source ip persistence on Virtual server A based with X forwarded IP information sent by another Virtual server B. both virtual server residing on different F5s

 

My architecture is virtual server A(Internet facing F5) ---> Linux revers proxies--> virtual server B (Internal F5)---> Actual pool members

 

Any help highly appreciated

 

2 Replies

  • Hello Paul,

    You can do it by different manner. One of them consist of :

    1) From VS_A : Add the "X-Forwarded-For" header using either the HTTP profile or by adding an irule that insert this header.

    when HTTP_REQUEST {
    HTTP::header insert X-Forwarded-For [IP::remote_addr]
    }
    

    Reference : https://support.f5.com/csp/article/K4816

    2) From VS_B : You will need to add the following irule, that will use "Universal persistance" on XFF header

    when HTTP_REQUEST {
        set clientip ""
        if { [HTTP::header exists "X-Forwarded-For"] } {
            set clientip [HTTP::header "X-Forwarded-For"]
        } else {
            set clientip [IP::client_addr]
        }
        persist uie $clientip
    } 
    
    when HTTP_RESPONSE {
        persist add uie $clientip
    }
    

    Reference : https://devcentral.f5.com/questions/universal-persistence-with-x-forwarder-47038

    Please give us a feedback.

    Hope it helps

    Regards

  • Robin1's avatar
    Robin1
    Icon for Nimbostratus rankNimbostratus

    Hi Abhilash, is your issue resolved? I am on the same boat, tried all possible scenarios still not working.