Forum Discussion

Philip_King_719's avatar
Philip_King_719
Icon for Nimbostratus rankNimbostratus
Apr 13, 2007

Adding client IP to header info

I've found a couple of articles about being able to add the client IP address to the header information, but haven't seen any that give the exact irule verbage to use. This is what I'm trying to use in the HTTP irule:

 

 

when HTTP_REQUEST {

 

HTTP::header insert ClientIPAddress [IP::client_addr]

 

}

 

 

Anyone out there succcessfully done this and see where I'm going wrong?
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Your rule looks fine, but I'm guessing that you haven't configured the web server to log that custom header, you've named ClinetIPAddress. You can actually enable the X-Forwarded-For header on your HTTP profile, and then configure the web server to parse and log the header.

     

     

    Check SOL4816 on AskF5 for details:

     

    Click here

     

     

    IIS logging:

     

    Click here

     

     

    Apache logging:

     

     

    Apache 1.3.x and Apache 2.0.x:

     

     

    Edit httpd.conf and add the following directive (Note you must restart the apache process to initialize the change).

     

     

    LogFormat "%v %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" x-forwarded-for

     

     

    CustomLog /var/log/apache/www.example.com-xforwarded.log x-forwarded-for

     

     

     

     

    Aaron