Browser Dependent Content

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.

At least for important top-level pages it is sometimes necessary to provide the optimum of browser dependent content, i.e. one has to provide a maximum version for the latest Netscape variants, a minimum version for the Lynx browsers and an average feature version for all others.

Example : We will act on the HTTP header “User-Agent”. The following config does the following: If the HTTP header “User-Agent” begins with “Mozilla/3”, the page foo.html is rewritten to foo.NS.html and the rewriting stops. If the browser is “Lynx” or “Mozilla” of version 1 or 2 the URL becomes foo.20.html. All other browsers receive page foo.32.html. This is done by the following rule set:

Apache rewrite:

RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/3.*
RewriteRule ^foo\.html$         foo.NS.html          [L]
RewriteCond %{HTTP_USER_AGENT}  ^Lynx/.*         [OR]
RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/[12].*
RewriteRule ^foo\.html$         foo.20.html          [L]
RewriteRule ^foo\.html$         foo.32.html          [L]

AppExpert rewrite:

Add patset pat1
Bind patset pat1 Mozilla/1
Bind Patset pat1 Mozilla/2
Bind patset pat1 Lynx
Bind Patset pat1 Mozilla/3

add rewrite action act1 insert_before 'HTTP.REQ.URL.SUFFIX' '<span class="code-quote">"NS."</span>'

add rewrite action act2 insert_before 'HTTP.REQ.URL.SUFFIX' '<span class="code-quote">"20."</span>'

add rewrite action act3 insert_before 'HTTP.REQ.URL.SUFFIX' '<span class="code-quote">"32."</span>'

add rewrite policy pol1 'HTTP.REQ.HEADER(<span class="code-quote">"User-Agent"</span>).STARTSWITH_INDEX(<span class="code-quote">"pat1"</span>).EQ(4)' act1

add rewrite policy pol2 'HTTP.REQ.HEADER(<span class="code-quote">"User-Agent"</span>).STARTSWITH_INDEX(<span class="code-quote">"pat1"</span>).BETWEEN(1,3)' act2

add rewrite policy pol3 '!HTTP.REQ.HEADER(<span class="code-quote">"User-Agent"</span>).STARTSWITH_ANY(<span class="code-quote">"pat1"</span>)' act3

bind rewrite global pol1 101 END
bind rewrite global pol2 102 END
bind rewrite global pol3 103 END

Tap into the power of AppExpert!