Forum Discussion

Mike_Maher's avatar
Mike_Maher
Icon for Nimbostratus rankNimbostratus
Mar 16, 2011

Insert IPv6 address into header

I have a fairly simple iRule that inserts the client IP address into the header see below

 

 

when HTTP_REQUEST {

 

HTTP::header insert x-remote-host [IP::client_addr]

 

HTTP::header insert x-user-agent [HTTP::header User-Agent]

 

}

 

 

The problem is that I know the IP::client_addr only works for v4 addresses, and I want to setup the rule so that it will also insert an IP v6 address if that is where the client is coming from. Any help is appreciated.

 

1 Reply

  • Hi Mike,

     

     

    IP::addr will work for IPv4 and IPv6 addresses, so you should be fine with your existing iRule. I think you can also do this with a custom HTTP profile by setting the Request Header to Insert to:

     

     

    [list "x-remote-host [IP::client_addr] x-user-agent [HTTP::header User-Agent]]

     

     

    Note I haven't tested this but I think it might work.

     

     

    Aaron