Objective
This article describes how to use URL Transformation??on NetScaler to change the destination path of a GET request based on the User-Agent.
Requirements
Before starting with the URL Transformation configuration it would be beneficial to get an HTTP Header trace to confirm the User-Agents for the client requests. The following two User-Agents are taken from a client using Firefox, version 3.5.8, and Microsoft Internet Explorer, version 7.0. The URL Transformation policy can be configured to match on any expression in the User-Agent header value field.
Firefox UA:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 GTB6 (.NET CLR 3.5.30729)
Internet Explorer UA:
User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 6.4.1321.1732; Windows XP 5.1; MSIE 7.0.5730.11)
Instructions
All of the following steps should be added through the NetScaler CLI, however, they can also be added through the GUI using the Rewrite section > URL Transformation sub-section.
-
Create the necessary profiles to contain the actions using the following commands:
add transform profile ua_url-trans_IE.pro
add transform profile ua_url-trans_Firefox_pro -
Create a URL Transformation action to adjust the URL in its entirety using the following commands. The protocol, hostname, path, and query can all be manually adjusted. The reqUrlFrom section supports Regex and has the ability to create variables ($1) based on word groups. The $1 - $9 variables can be used in the reqUrlInto section.
add transform action ua_url-trans_Firefox_act ua_url-trans_Firefox_pro 100
add transform action ua_url-trans_IE_act ua_url-trans_IE.pro 100
set transform action ua_url-trans_Firefox_act -priority 100 -reqUrlFrom "http://10.54.80.224" -reqUrlInto "http://10.54.80.224/Firefox"
set transform action ua_url-trans_IE_act -priority 100 -reqUrlFrom "http://10.54.80.224" -reqUrlInto "http://10.54.80.224/IE" -
Configure policies to match the destination IP address of the virtual server and the User-Agent header. The regular expression match of the User-Agent header will be case insensitive. The IP address of the VIP is added because of the global binding of URL transformation.
add transform policy ua_url-trans_Firefox_pol "http.REQ.HOSTNAME.EQ(\"10.54.80.224\") && HTTP.REQ.HEADER(\"User-Agent\").SET_TEXT_MODE(IGNORECASE).REGEX_MATCH(re/Firefox/) " ua_url-trans_Firefox_pro
add transform policy ua_url-trans_IE_pol "http.REQ.HOSTNAME.EQ(\"10.54.80.224\") && HTTP.REQ.HEADER(\"User-Agent\").SET_TEXT_MODE(IGNORECASE).REGEX_MATCH(re/MSIE/) " ua_url-trans_IE.pro -
Globally bind the URL Transformation policies in priority order 20 and 30 using the following commands. When using global bind points you should make the policy expression as specific as possible to prevent matching unintended client requests.
bind transform global ua_url-trans_Firefox_pol 20
bind transform global ua_url-trans_IE_pol 30
Additional Resources
The following packet capture screen shot shows a client GET request, using Firefox, to / being adjusted to /Firefox/ for the NetScaler request to the back end server. The second GET request from the client was made using Internet Explorer as the web browser. This resulted in the GET / request being manipulated to GET /IE/ for the back end request.
Environment:
-
Client IP - 10.54.67.214
-
Virtual Server - 10.54.80.224
-
SNIP - 10.54.80.33
-
Server - 10.54.80.24
Disclaimer
Supporto Citrix
Traduzione automatica
Questo articolo ??¨ stato tradotto da un sistema di traduzione automatica e non ??¨ stata valutata da persone. Citrix fornisce traduzione automatica per aumentare l'accesso per supportare contenuti; tuttavia, articoli automaticamente tradotte possono possono contenere degli errori. Citrix non ??¨ responsabile di incongruenze, errori o danni derivanti dell'uso di articoli automaticamente tradotte.
Citrix技術支持
自動翻譯
這篇文章被翻譯由一個自動翻譯系統,並沒有受到人們的審查。 Citrix提供自動翻譯,增加獲得支持的內容;但是,自動翻譯的文章可能可以包含錯誤。思傑不負責不一致,錯誤或損壞因使用自動翻譯的文章的結果。
Поддержка Citrix
Tradução automática
Эта статья была переведена автоматической системой перевода и не был рассмотрен людьми. Citrix обеспечивает автоматический перевод с целью расширения доступа для поддержки контента; Однако, автоматически переведенные статьи могут может содержать ошибки. Citrix не несет ответственности за несоответствия, ошибки, или повреждения, возникшие в результате использования автоматически переведенных статей.
시트릭스 지원
자동 번역
이 문서 자동 번역 시스템에 의해 번역 된 사람들에 의해 검토되지 않았다. 시트릭스는 컨텐츠를 지원하기 위해 접근을 높이기 위해 자동 번역을 제공합니다; 그러나, 자동으로 번역 기사 오류를 포함 할 수있다. 시트릭스는 자동으로 번역 된 기사의 사용의 결과로 발생하는 불일치, 오류 또는 손해에 대해 책임을지지 않습니다.