Replace Tag Content Assertion

The Replace Tag Content assertion provides search-and-replace functionality for content within tags, in HTML or XML files (even where the HTML/XML is not properly formed).
gateway90
The
Replace Tag Content
assertion provides search-and-replace functionality for content within tags, in HTML or XML files (even where the HTML/XML is not properly formed).
This assertion is especially useful in reverse web proxy scenarios, where the Gateway needs to manipulate HTML content in a route response before it is returned to the client.
The Evaluate Regular Expression Assertion can also be used to search and replace content in the response, but it is difficult to create regular expressions that search and modify only select areas of the HTML code.
Example use case:
Some HTML tags (anchor, script, etc.) may contain content or attributes that references the web application host which is unknown to the client. Use the Replace Tag Content assertion to change the references to the Gateway host, which is serving as a reverse proxy to the web application.
To learn about selecting the target message for this assertion, see Selecting a Target Message.
Using the Assertion
  1. Do one of the following:
    • To add the assertion to the Policy Development window, see Add an Assertion.
    • To change the configuration of an existing assertion, proceed to step 2 below.
  2. When adding the assertion, the Replace Tag Content Properties automatically appear; when modifying the assertion, right-click
    <target>:
    Replace...
    in the policy window and select
    Replace Tag Content Properties
    or double-click the assertion in the policy window. The assertion properties are displayed. 
  3. Configure the properties as follows:
    Setting
    Description
    Search For
    Enter the string to search for. You may reference context variables.
    By default, the search is case sensitive. To make it case insensitive, select the
    Ignore Case
    check box.
    Replace With
    Enter the replacement text. You may reference context variables.
    Within Tags
    Specify the tag(s) to search (case insensitive). Separate multiple tags with commas. You may reference context variables.
  4. Click [
    OK
    ] when done.