Forum Discussion

dinodell4477's avatar
dinodell4477
Icon for Nimbostratus rankNimbostratus
Feb 11, 2022

XFF replace iRule help

How would I go about replacing the X-Forwarded-For header with a value from another header such as "Real-Client-IP" for example. Something like the below is what i'm statrting with but this obviously isnt working. 

when HTTP_REQUEST {
HTTP::header replace X-Forwarded-For HTTP::header value Real-Client-IP [HTTP::header value X-Forwarded-For]
}

Thanks in advance!

  • Hello Tetimmons.

    Try this:

    when HTTP_REQUEST {
       HTTP::header replace X-Forwarded-For [HTTP::header value Real-Client-IP]
       HTTP::header remove Real-Client-IP
    }

     

  • Hello Tetimmons.

    Try this:

    when HTTP_REQUEST {
       HTTP::header replace X-Forwarded-For [HTTP::header value Real-Client-IP]
       HTTP::header remove Real-Client-IP
    }