240 Citrix NetScaler Policy Configuration and Reference Guide
Rewrite instances of http:/
/ to https:// in all URLs.
This policy uses
Responder functionality.
add responder action httpToHttpsAction
redirect "\"https://\" + http.req.hostname +
http.req.url" -bypassSafetyCheck YES
add responder policy httpToHttpsPolicy
"!CLIENT.SSL.IS_SSL" httpToHttpsAction
bind responder global httpToHttpsPolicy 1 END
-type OVERRIDE
Modify a URL to redirect
from URL A to URL B. In
this example, “file5.html”
is appended to the path.
This policy uses
Responder functionality.
add responder action appendFile5Action
redirect "\"http://\" + http.req.hostname +
http.req.url + \"/file5.html\""
-bypassSafetyCheck YES
add responder policy appendFile5Policy
"http.req.url.eq(\"/testsite\")"
appendFile5Action
bind responder global appendFile5Policy 1 END
-type OVERRIDE
Redirect an external URL
to an internal URL. add rewrite action act_external_to_internal
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
www.example.com that
have a query string to
www.Webn.example.com.
The value n is derived
from a server parameter in
the query string, for
example, server=5.
add rewrite action act_redirect_query REPLACE
q#http.req.header("Host").before_str(".examp
le.com")' '"Web" +
http.req.url.query.value("server")#
add rewrite policy pol_redirect_query
q#http.req.header("Host").eq("www.example.co
m") && http.req.url.contains("?")'
act_redirect_query#
Examples of Advanced Expressions and Policies
Purpose Example