Example 2: Add a local client-IP header
Example Inc. wants to add a local Client-IP HTTP header to incoming requests. This example contains two slightly different versions of the same basic task.
To add a local Client-IP header by using the command line interface
At the command prompt, type the following commands in the order shown:
add rewrite action act_ins_client insert_http_header NS-Client 'CLIENT.IP.SRC'
add rewrite policy pol_ins_client 'HTTP.REQ.HEADER("x-forwarded-for").EXISTS || HTTP.REQ.HEADER("client-ip").EXISTS' act_ins_client
bind rewrite global pol_ins_client 300 END
To add a local Client-IP header by using the configuration utility
In the Create Rewrite Action dialog box, create a rewrite action with the following description.
| Name | Type | Argument(s) |
|---|---|---|
| act_ins_client | insert_http_header | NS-Client 'CLIENT.IP.SRC' |
In the Create Rewrite Policy dialog box, create a rewrite policy with the following description.
| Name | Expression | Action |
|---|---|---|
| pol_ins_client | 'HTTP.REQ.HEADER("x-forwarded-for").EXISTS || HTTP.REQ.HEADER("client-ip").EXISTS' | act_ins_client |
Bind policy to global, assigning the priorities and goto expression values shown below.
| Name | Priority | Goto Expression |
|---|---|---|
| pol_ins_client | 100 | Next |