Canonical URLs



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. On some Apache web servers there is more than one URL for a resource. Usually there are canonical URLs (which should be used and distributed as a best practive) and those which are just shortcuts, internal ones, etc. Independent of which URL was supplied with the request, the user should only see the canonical one URL in the response.

Example : converting URL /~user to /u/user.

Apache rewrite:

RewriteRule   ^/~([^/]+)/?(.*)    /u/$1/$2[R]



AppExpert rewrite:

Add responder action act1 redirect  '<span class="code-quote">"/u/"</span>+HTTP.REQ.URL.AFTER_STR(<span class="code-quote">"/~"</span>)' -bypassSafetyCheck yes
Add responder policy pol1 'HTTP.REQ.URL.STARTSWITH(<span class="code-quote">"/~"</span>) &amp;&amp; HTTP.REQ.URL.LENGTH.GT(2)' act1
Bind responder global pol1 100



Tap into the power of AppExpert!