Appendix B Summary Examples of Advanced Expressions and Policies 243

Examples of Advanced Expressions and Policies

Purpose

Example

 

 

Remove old headers from

add rewrite action del_x_forwarded_for

a request, insert an

delete_http_header x-forwarded-for

NS-Client header, and

add rewrite action del_client_ip

then modify the “insert

header” action so that the

delete_http_header client-ip

value of the inserted

add rewrite policy

header contains the client

IP values from the old

check_x_forwarded_for_policy

headers and the

'HTTP.REQ.HEADER("x-forwarded-for").EXISTS'

NetScaler’s connection IP

del_x_forwarded_for

address.

add rewrite policy check_client_ip_policy

Note that this example

'HTTP.REQ.HEADER("client-ip").EXISTS'

repeats the previous

del_client_ip

example, with the

add rewrite action insert_ns_client_header

exception of the final set

rewrite action.

insert_http_header NS-Client 'CLIENT.IP.SRC'

 

add rewrite policy insert_ns_client_policy

 

'HTTP.REQ.HEADER("x-forwarded-for").EXISTS

 

HTTP.REQ.HEADER("client-ip").EXISTS'

 

insert_ns_client_header

 

bind rewrite global

 

check_x_forwarded_for_policy 100 200

 

bind rewrite global check_client_ip_policy

 

200

300

bind rewrite global insert_ns_client_policy 300 END

set rewrite action insert_ns_client_header -stringBuilderExpr 'HTTP.REQ.HEADER("x-forwarded-for").VALUE(0)

+" " + HTTP.REQ.HEADER("client-ip").VALUE(0)

+" " + CLIENT.IP.SRC' -bypassSafetyCheck YES

Page 257
Image 257
Citrix Systems 9.2 Request, insert an, NS-Client header, Then modify the insert, Header action so that, Example, with