Appendix B Summary Examples of Advanced Expressions and Policies 243
Remove old headers from
a request, insert an
NS-Client header, and
then modify the “insert
header” action so that the
value of the inserted
header contains the client
IP values from the old
headers and the
NetScaler’s connection IP
address.
Note that this example
repeats the previous
example, with the
exception of the final set
rewrite action.
add rewrite action del_x_forwarded_for
delete_http_header x-forwarded-for
add rewrite action del_client_ip
delete_http_header client-ip
add rewrite policy
check_x_forwarded_for_policy
'HTTP.REQ.HEADER("x-forwarded-for").EXISTS'
del_x_forwarded_for
add rewrite policy check_client_ip_policy
'HTTP.REQ.HEADER("client-ip").EXISTS'
del_client_ip
add rewrite action insert_ns_client_header
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
Examples of Advanced Expressions and Policies
Purpose Example