Forum Discussion

draco's avatar
draco
Icon for Nimbostratus rankNimbostratus
Jan 06, 2019

Is it possible to replace source ip as x forwarded ip?

Can we change the client/source ip before sending the request to the server with the x forwarded ip. The application team needs to use the source ip in their code.

 

2 Replies

  • Draco,

    Here is an iRule that should take the contents of the X-Forwarded-For header and SNAT to that IP. I would be careful with this though as unless the F5 is set you be your default gateway, the server may try to send the data back to the client directly. This asymmetrical routing will cause issues with connection.

    when HTTP_REQUEST
    {
        snat [HTTP::header value X-Forwarded-For]
    }
    

    If you have any issues with this iRule or any further questions, I am sure I can help.

  • Draco,

    Here is an iRule that should take the contents of the X-Forwarded-For header and SNAT to that IP. I would be careful with this though as unless the F5 is set you be your default gateway, the server may try to send the data back to the client directly. This asymmetrical routing will cause issues with connection.

    when HTTP_REQUEST
    {
        snat [HTTP::header value X-Forwarded-For]
    }
    

    If you have any issues with this iRule or any further questions, I am sure I can help.