ADC

Use Case: ESI support for fetching and updating content dynamically

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 Citrix ADC 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 Citrix ADC 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

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

To enable rewrite by using the GUI

  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 Citrix ADC Appliance

For more information about creating an HTTP callout, see Configuring an HTTP Callout. For more information about the parameter values, see Parameters and Values for HTTP-Callout-2 pdf.

Configuring the Rewrite Action

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.

Parameter Value
Name Action-Rewrite-1
Type Replace
Expression to choose target text reference “HTTP.RES.BODY(500).AFTER_STR (\” \”).BEFORE_STR (\”\”)”
String expression for replacement text “SYS.HTTP_CALLOUT(HTTP-Callout-2)”

Table 2. Parameters and Values for Action-Rewrite-1

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>")"
    <!--NeedCopy-->
    
  6. In the String expression for replacement text, type the following string expression:

    "SYS.HTTP_CALLOUT(HTTP-Callout-2)"
    <!--NeedCopy-->
    
  7. Click Create, and then click Close.

Creating the Rewrite Policy and Binding it Globally

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.

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”

Table 3. Parameters and Values for Policy-Rewrite-1

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"
      <!--NeedCopy-->
      
    5. Click Create, and then click Close.

6. Click Apply Changes, and then click Close.

Use Case: ESI support for fetching and updating content dynamically