240Citrix NetScaler Policy Configuration and Reference Guide

Examples of Advanced Expressions and Policies

Purpose

Example

 

 

Rewrite instances of http:/

add responder action httpToHttpsAction

/ to https:// in all URLs.

redirect "\"https://\" + http.req.hostname +

This policy uses

http.req.url" -bypassSafetyCheck YES

Responder functionality.

add responder policy httpToHttpsPolicy

 

 

"!CLIENT.SSL.IS_SSL" httpToHttpsAction

 

bind responder global httpToHttpsPolicy 1 END

 

-type OVERRIDE

Modify a URL to redirect

add responder action appendFile5Action

from URL A to URL B. In

redirect "\"http://\" + http.req.hostname +

this example, “file5.html”

http.req.url + \"/file5.html\""

is appended to the path.

-bypassSafetyCheck YES

This policy uses

add responder policy appendFile5Policy

Responder functionality.

"http.req.url.eq(\"/testsite\")"

 

 

appendFile5Action

 

bind responder global appendFile5Policy 1 END

 

-type OVERRIDE

Redirect an external URL

add rewrite action act_external_to_internal

to an internal URL.

REPLACE 'http.req.hostname.server'

 

'"www.my.host.com"'

 

add rewrite policy pol_external_to_internal

 

'http.req.hostname.server.eq("www.external.h

 

ost.com")' act_external_to_internal

 

bind rewrite global pol_external_to_internal

 

100 END -type REQ_OVERRIDE

Redirect requests to

add rewrite action act_redirect_query REPLACE

www.example.com that

q#http.req.header("Host").before_str(".examp

have a query string to

le.com")' '"Web" +

www.Webn.example.com.

http.req.url.query.value("server")#

The value n is derived

add rewrite policy pol_redirect_query

from a server parameter in

the query string, for

q#http.req.header("Host").eq("www.example.co

example, server=5.

m") && http.req.url.contains("?")'

 

act_redirect_query#

Page 254
Image 254
Citrix Systems 9.2 manual To https// in all URLs, This policy uses, Responder functionality, Modify a URL to redirect