Forum Discussion

Tien_Dinh_12223's avatar
Tien_Dinh_12223
Icon for Nimbostratus rankNimbostratus
Oct 16, 2018

F5 BIG IP VIP persistent profile with X-Real-IP header instead of X-Forwarded-For header

How do we configure persistent profile to use X-Real-IP header? I assume the current option with source IP is using X-Forwarded-For header.

 

1 Reply

  • Source Address Affinity persistence persists based solely on the source IP address of a packet, not on any value provided in an HTTP X-Forwarded-For header. That allows it to work with more than HTTP traffic.

    Having said that, you can persist on pretty much anything in a BIG-IP environment, including a X-Real-IP header, using universal persistence and an iRule. The universal persistence profile (instead of a source address affinity persistence profile) points to the iRule that will set persistence based on the contents of the X-Real-IP header. For example:

    when HTTP_REQUEST {
        if { [HTTP::header exists "X-Real-IP"] } {
            persist uie [HTTP::header "X-Real-IP"] 
        } else {
             Persist on something else such as X-Forwarded-For or client IP address
        }
    }
    

    You'll also need an HTTP-type profile on the virtual server.