How to Insert a Client IP Address in an HTTP Header Without Using the Client IP Insertion Feature of a NetScaler Appliance

How to Insert a Client IP Address in an HTTP Header Without Using the Client IP Insertion Feature of a NetScaler Appliance

book

Article ID: CTX128802

calendar_today

Updated On:

Description

To insert a Client IP address in an HTTP header without using the Client IP Insertion feature of a NetScaler appliance, complete the following procedure from the command line interface of the NetScaler appliance:

  1. Run the following command to create a rewrite action for adding the Client IP address to the x-ip HTTP header:

    add rewrite action insert_xip_act insert_http_header x-ip CLIENT.IP.SRC
  2. Run the following command to create a rewrite policy:

    add rewrite policy insert_xip_pol "!HTTP.REQ.HEADER(\"x-ip\").EXISTS" insert_xip_act

    Note: You can also use named expressions with AppExpert for configuring the policies. You can use the name of the expression instead of referring to the entire expression in a policy. To create a name for a policy expression, run the following command:

    add policy expression adv_expr_xip_not_exist "!HTTP.REQ.HEADER(\"x-ip\").EXISTS"

    You can then use the adv_expr_xip_not_exist expression name when creating the rewrite policy instead of the actual expression.

  3. Run the following command to bind the rewrite policy at the global level of the appliance:

    bind rewrite global insert_xip_pol 90 END -type REQ_OVERRIDE

    The following are sample screen shots indicating the insertion of x-ip HTTP header in Firefox Tamper Data:

    User-added image

    User-added image

    Notice that the original x-ip HTTP header from the back end server is not modified.

    Note: These screen shots are captured from HTTP requests before a NetScaler appliance is implemented between the client and the back end server.

    The following is a sample screen shot of the network packet trace on a NetScaler appliance after implementing an appliance between the client and the back end server:

    User-added image

    Notice that the x-ip HTTP header is added to the GET HTTP request.

Issue/Introduction

This article describes how to insert a Client IP address in an HTTP header without using the Client IP Insertion feature of a NetScaler appliance.