CTX129107
NetScaler 9.2
NetScaler 9.2
Article
2012-03-10
2012-03-10
Summary This document contains information about configuring an HTTP Callout for mobile user agents by using an external server. ...

Summary

This document contains information about configuring an HTTP Callout for mobile user agents by using an external server.

Background

You might want to ensure that only end users with a mobile user agent can access the mobile version of the Web site for any of the following conditions:

  • The mobile version of the Web site works only with a mobile user agent
  • Prevent a specific type of application Denial of Service (DoS) attack on the Web site

Configuring an HTTP Callout with for Mobile User Agents

To configure an HTTP Callout for mobile user agents by using an external server, complete the following procedure:

  1. If not enabled, run the following command from the command line interface of the appliance to enable the Responder and Rewrite features:
    enable ns feature responder rewrite
  1. Run the following command to create an HTTP Callout:
    add policy httpCallout callout_mobile
  1. Run the following command to configure the HTTP Callout:
    set policy httpCallout callout_mobile -IPAddress 10.90.196.76 -port 80 -returnType TEXT -hostExpr "\"10.90.196.76\"" -urlStemExpr "\"/~mark/mob/mobtest.php\"" -headers User-Agent(http.REQ.HEADER("User-Agent")) -resultExpr "http.RES.BODY(1000)"
    The following are the descriptions for some of the parameters in the preceding command:
    • 10.90.196.76: This is the IP address of the Virtual Server (VServer) that identifies if the client has a mobile user agent.
    • /~mark/mob/mobtest.php: This is the Web page with php script that identifies if the client has mobile user agent.
    • User-Agent(http.REQ.HEADER("User-Agent")): This is the user agent header that is forwarded to the Web page.
    • resultExpr "http.RES.BODY(1000)": This parameter searches the first 1000 bytes of data in the body of the response sent from the callout server.
  1. Run the following command to add a Load Balancing VServer:
    add lb vserver lb_vs_mobile-callout HTTP 10.90.196.76 82 -persistenceType NONE -cltTimeout 180
  1. Run the following command to bind a service to the VServer:
    bind lb vserver lb_vs_mobile-callout service_mobile
  1. Run the following commands to create responder policies:
    add responder policy mobile_allow "http.REQ.HEADER(\"User-Agent\").EXISTS && SYS.HTTP_CALLOUT(callout_mobile).CONTAINS(\"True\")" NOOP
    add responder policy mobile_drop "http.REQ.HEADER(\"User-Agent\").EXISTS && sys.http_callout(callout_mobile).contains(\"False\")" RESET
  1. Run the following command to bind the responder policy at the global level:
    bind responder global mobile_drop 90 END -type REQ_DEFAULT
    bind responder global mobile_allow 100 END -type REQ_DEFAULT
  1. Run the following command to create a Rewrite action:
    add rewrite action act_rewrite_url_mobile_callout replace "http.REQ.HOSTNAME.EQ(\"mob.\")" "\"www\""
    Note: You can redirect the HTTP requests to the appropriate Web site instead of creating a rewrite policy and action. Refer to the Knowledge Center article CTX126974 – [Document Not Found] for more information.
  1. Run the following command to create a Rewrite policy:
    add rewrite policy pol_rewrite_url_mobile_callout "http.REQ.URL.STARTSWITH(\"mob\") && http.REQ.HEADER(\"User-Agent\").EXISTS && SYS.HTTP_CALLOUT(callout_mobile).CONTAINS(\"False\")" act_rewrite_url_mobile_callout
  1. Run the following command to bind the Rewrite policy at the global level:
    bind rewrite global pol_rewrite_url_mobile_callout 50 END -type REQ_OVERRIDE
  1. Create a callout agent on the remote server.
    The Wireless Universal Resource File (WURFL) has a list of valid user agent strings used to identify user agents from mobile clients. If a valid user agent is present in the request, then the “UA matched” response is sent to the appliance. Else, the “UA failed” response is sent to the appliance from the remote server.
    The following is an excerpt from a sample PHP code from a Web server that checks the User-Agent string in the HTTP request:
    <?php
    require_once 'WURFL/Application.php';
    $wurflConfigFile = 'resources/wurfl-config.xml';
    $wurflConfig = new WURFL_Configuration_XmlConfig($wurflConfigFile);
    $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
    $wurflManager = $wurflManagerFactory->create();
    $device = $wurflManager->getDeviceForHttpRequest($_SERVER);
    $markUp = $device->getCapability('xhtml_support_level');
    if ($markUp == 4) {
    ?? ?? ?? ?? ?? ?? ?? echo 'False';
    } else {
    ?? ?? ?? ?? ?? ?? ?? echo 'True';
    }
    ?>

Applicable Products

特别说明


本文来源为Citrix.com所有,翻译后版权归翻译者所有.如需转载请注明出处.

文档版本


.

广告招租


最新留言


.

广告招租


.