172Citrix NetScaler Policy Configuration and Reference Guide

Typecasting Operations

Operation

Description

 

 

numeric

Treats a numeric string like an IP address.

string.TYPECAST_IP_

For example, the following policy matches HTTP requests

ADDRESS_T

that contains Cookie headers with a value of:

 

12.34.56.78\r\n.

 

set rewrite policy ip_check_policy -rule

 

'http.req.cookie.value("ip").typecast_ip_

 

address_t.eq(12.34.56.78)'

 

bind rewrite global ip_check_policy 200 -

 

type req_default

numeric

Treats a string as an IPv6 address in the following format:

string.TYPECAST_

0000:0000:CD00:0000:0000:00AB:0000:CDEF

IPV6_ADDRESS_T

 

text.TYPECAST_HTTP_

Treats the designated text as the URL in the first line of an

URL_T

HTTP request header. The supported format is [protocol://

 

hostname]path?query, and the text mode is set to

 

URLENCODED by default.

 

For example, the following policy replaces a URL-encoded

 

part of a string in an HTTP header named Test.

 

add rewrite action replace_header_string

 

replace "http.req.header(\"Test\").typecast_

 

http_url_t.path.before_str(\"123\").after_

 

str(\"ABC\")" "\"string\""

 

add rewrite policy rewrite_test_header_

 

policy true replace_header_string

 

bind rewrite global rewrite_test_header_

 

policy 1 END -type res_override

 

Consider the following header:

 

Test: ABC%12123\r\n

 

This policy would replace the preceding header with the

 

value ABC%string123\r\n.

Page 186
Image 186
Citrix Systems 9.2 Treats a numeric string like an IP address, For example, the following policy matches Http requests