Citrix ADC

Use Case: ESI support for fetching and updating content dynamically

边缘方面包括(ESI)是一种标记语言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, seeConfiguring an HTTP Callout. For more information about the parameter values, seeParameters and Values for HTTP-Callout-2pdf.

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.

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 (\” \”).BEFORE_STR (\”\”)”
String expression for replacement text “SYS.HTTP_CALLOUT(HTTP-Callout-2)”

To configure the rewrite action by using the configuration utility

  1. Navigate toAppExpert>Rewrite>Actions.
  2. In the details pane, clickAdd.
  3. In theCreate Rewrite Actiondialog box, in Name, typeAction-Rewrite-1.
  4. In Type, selectREPLACE.
  5. InExpressionto choose target text reference, type the following default syntax expression:

    "HTTP.RES.BODY(500).AFTER_STR("").BEFORE_STR("")" 
  6. In the String expression for replacement text, type the following string expression:

    "SYS.HTTP_CALLOUT(HTTP-Callout-2)" 
  7. ClickCreate, and then clickClose.

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.

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 toAppExpert>Rewrite.
  2. In the details pane, underPolicy Manager, clickRewrite Policy Manager.
  3. In theRewrite Policy Managerdialog box, clickOverride Global.
  4. ClickInsert Policy, and then, in thePolicy Namecolumn, clickNew Policy.
  5. In theCreate Rewrite Policydialog box, do the following: 1.In Name, type Policy-Rewrite-1.
    1. In Action, select Action-Rewrite-1.
    2. In Undefined-Result Action, select Global undefined-result action.
    3. In Expression, type the following default syntax expression:
    "HTTP.REQ.HEADER("Name").CONTAINS("Callout").NOT" 
    1. ClickCreate, and then clickClose.
  6. ClickApply Changes, and then clickClose.
Use Case: ESI support for fetching and updating content dynamically