Product Documentation

Use Case: ESI Support for Fetching and Updating Content Dynamically

Aug 31, 2016

Edge Side Includes (ESI) is a markup language for edge-level dynamic Web content assembly. It helps in accelerating dynamic Web-based applications by defining a simple markup language to describe cacheable and non-cacheable Web page components that can be aggregated, assembled, and delivered at the network edge. By using HTTP callouts on the NetScaler appliance, you can read through the ESI constructs and aggregate or assemble content dynamically.

To implement this configuration, you must perform the following tasks:

  1. Enable rewrite on the NetScaler appliance.
  2. Create an HTTP callout on the appliance and configure it with details about the external server and other required parameters.
  3. Configure a rewrite action to replace the ESI content with the callout response body.
  4. Configure a rewrite policy to specify the conditions under which the action is performed, and then bind the rewrite policy globally.

Enabling Rewrite

Updated: 2013-08-30

Rewrite must be enabled before it is used on the NetScaler appliance. The following procedure describes the steps to enable the rewrite feature.

To enable rewrite by using the configuration utility

  1. Make sure that you have installed the rewrite license.
  2. In the configuration utility, expand AppExpert, and right-click Rewrite, and then click Enable Rewrite feature.

Creating an HTTP Callout on the NetScaler Appliance

Updated: 2013-08-30

Create an HTTP callout, HTTP-Callout-2, with the parameter settings shown in the following table. For more information about creating an HTTP callout, see "Configuring an HTTP Callout."
Table 1. Parameters and Values for HTTP-Callout-2
Parameter Value
Name HTTP-Callout-2
Server to receive callout request
IP Address 10.102.56.51
Port 80
Request to send to the server
Method GET
Host Expression 10.102.56.51:80
URL Stem Expression "HTTP.RES.BODY(500).AFTER_STR(\"src=\").BEFORE_STR(\"/>\")"
Headers
Name Name
Value-expression Callout
Server Response
Return Type TEXT
Expression to extract data from the response HTTP.RES.BODY(100)

Configuring the Rewrite Action

Updated: 2013-08-30

Create a rewrite action, Action-Rewrite-1, to replace the ESI content with the callout response body. Use the parameter settings shown in the following table.

Table 2. Parameters and Values for Action-Rewrite-1
Parameter Value
Name Action-Rewrite-1
Type Replace
Expression to choose target text reference "HTTP.RES.BODY(500).AFTER_STR (\" <example>\").BEFORE_STR (\"</example>\")"
String expression for replacement text "SYS.HTTP_CALLOUT(HTTP-Callout-2)"

To configure the rewrite action by using the configuration utility

  1. Navigate to AppExpert > Rewrite > Actions.
  2. In the details pane, click Add.
  3. In the Create Rewrite Action dialog box, in Name, type Action-Rewrite-1.
  4. In Type, select REPLACE.
  5. In Expression to choose target text reference, type the following default syntax expression:
    "HTTP.RES.BODY(500).AFTER_STR(\"<example>\").BEFORE_STR(\"</example>\")"
  6. In the String expression for replacement text, type the following string expression:
    "SYS.HTTP_CALLOUT(HTTP-Callout-2)"
  7. Click Create, and then click Close.

Creating the Rewrite Policy and Binding it Globally

Updated: 2013-08-30

Create a rewrite policy, Policy-Rewrite-1, with the parameter settings shown in the following table. You can create a rewrite policy in the Policies subnode and then bind it globally by using the Rewrite Policy Manager. Alternatively, you can use the Rewrite Policy Manager to perform both these tasks simultaneously. This demonstration uses the Rewrite Policy Manager to perform both tasks.
Table 3. Parameters and Values for Policy-Rewrite-1
Parameter Value
Name Policy-Rewrite-1
Action Action_Rewrite-1
Undefined Result Action -Global undefined-result action-
Expression "HTTP.REQ.HEADER(\"Name\").CONTAINS (\"Callout\").NOT"

To configure a rewrite policy and bind it globally by using the configuration utility

  1. Navigate to AppExpert > Rewrite.
  2. In the details pane, under Policy Manager, click Rewrite Policy Manager.
  3. In the Rewrite Policy Manager dialog box, click Override Global.
  4. Click Insert Policy, and then, in the Policy Name column, click New Policy.
  5. In the Create Rewrite Policy dialog box, do the following:
    1. In Name, type Policy-Rewrite-1.
    2. In Action, select Action-Rewrite-1.
    3. In Undefined-Result Action, select Global undefined-result action.
    4. In Expression, type the following default syntax expression:
      "HTTP.REQ.HEADER(\"Name\").CONTAINS(\"Callout\").NOT"
    5. Click Create, and then click Close.
  6. Click Apply Changes, and then click Close.