Copy X-Forwarded-For into custom header

Hi,

Does anyone know if there is a way to copy the source ip from “X-Forwarded-For” into a customer header? We’re trying to preserve the true source IP from users after traffic is sent to our A10 from a proxy firewall and our application uses a custom header for specific functionality. I’d imagine this is plausible with aflex we just don’t know how to write it up.

Hello, I think this should do the trick: Replace Other-Custom-Header with the header name you need.


when HTTP_REQUEST {
 if { [ HTTP::header exists "X-Forwarded-For"] }  {
   HTTP::header insert "Other-Custom-Header" [HTTP::header X-Forwarded-For]
 }
}

That worked, thank you so much!

Good to hear!

My pleasure :slight_smile: