Time Dependent Rewriting



The Citrix NetScaler can be placed in front of a webserver farm that is running Apache. The same re-write rules that run on Apache, can be implemented on the Citrix NetScaler.

We can rewrite a URL based on time.

Example : Changing the request foo.html to foo.day.html or foo.night.html according to time.

Apache rewrite:

RewriteCond   %{TIME_HOUR}%{TIME_MIN} >0700
RewriteCond   %{TIME_HOUR}%{TIME_MIN} <1900
RewriteRule   ^foo\.html$             foo.day.html [L]
RewriteRule   ^foo\.html$             foo.night.html



AppExpert rewrite:

Add rewrite action act1 insert_before 'HTTP.REQ.URL.PATH.SUFFIX(\'.\',0)' '<span class="code-quote">"day."</span>'

Add rewrite action act2  insert_before 'HTTP.REQ.URL.PATH.SUFFIX(\'.\',0)' '<span class="code-quote">"night."</span>'

add rewrite  policy pol1 'SYS.TIME.WITHIN(LOCAL 07h 00m,LOCAL 18h 59m)' act1

add rewrite policy pol2 '<span class="code-keyword">true</span>'  act2

bind rewrite global pol1 101

bind rewrite global pol2 102



Tap into the power of AppExpert!