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:
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
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.
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:
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:
Notice that the x-ip HTTP header is added to the GET HTTP request.