Manual Chapter : Inserting Content in to HTML Pages

Applies To:

Show Versions Show Versions


  • 12.1.6, 12.1.5, 12.1.4, 12.1.3, 12.1.2, 12.1.1, 12.1.0
Manual Chapter

Inserting Content in to HTML Pages

Overview: Inserting content into HTML pages

You can use the Policy Enforcement Manager™ (™PEM) for header modifications by configuring insertion of content into HTML web pages, based on a PEM policy. The content inserted can be a string or TCL script, and can occur in the beginning, middle, or end of the HTML page.

Insertion of content is useful in these scenarios:

  • To insert tailor made ads to certain subscribers based on profiles.
  • For sending alerts to the subscriber when the usage quota is reached.
  • For periodically sending the subscriber usage statistics.

PEM inserts the content at the match tag, and, depending on the throttling level, implements:

  • If the content needs to be inserted once per subscriber.
  • Periodic insertions into the transactions, which matches the criteria. (You can configure the periodic timer.)
  • Insertion in all the transactions matching the action.

Configuring content insertion for policy action

Before you can insert content in to the HTML pages, on the BIG-IP® system, you need to create an enforcement policy and add rules to an enforcement policy. You can add the content action as one of the actions to the existing list of actions supported by PEM. You can also control the insertion frequency through configuration per transaction.
Note: The size of the content being inserted cannot be more than 65k letters.
  1. On the Main tab, click Policy Enforcement > Policies .
    The Policies screen opens.
  2. Click the name of the enforcement policy you want to add rules to.
    The properties screen for the policy opens.
  3. In the Policy Rules area, click Add.
    The New Rule screen opens.
  4. In the Name field, type a name for the rule.
  5. In the Precedence field, type an integer that indicates the precedence for the rule in relation to the other rules. Number 1 has the highest precedence. Rules with higher precedence are evaluated before other rules with lower precedence.
    Tip: All rules in a policy are run concurrently. Precedence takes effect when there are conflicting rules. The conflict occurs when the traffic matches two rules and the policy actions from these rules differ. For example, if you have rule 1 with precedence 10 and Gate Status disabled for a search engine, and you have rule 2 with precedence 11 and Gate Status enabled, then rule 1 is processed first because it has higher precedence. Rules conflict if they have identical or overlapping classification criteria (for the traffic that matches more than one rule). In some cases, different policy actions are not conflicting, and hence, applied in parallel.
  6. Use the Classification, URL, Flow, and Custom Criteria tabs to identify the traffic that you want to be affected by this rule.
  7. From the Insert Content list, select Enabled, to modify the content insertion.
    Note: The BIG-IP system does not allow matching tags that are inserted, by insert action, on a given flow.
    More content insertion configuration options display.
  8. To insert content, select the action you want to implement.
    • From the Position list, select Before to prepend (opening and closing) the HTTP tag. Specify the tag name from the HTTP Tag list.
    • From the Position list, select After to append (opening and closing) the HTTP tag. Specify the tag name from the HTTP Tag list.
  9. In the Type field, type the string that defines the content, or the TCL script, which can be later attached to a policy enforcement rule.
    HTTP::header replace Server \"Nginx\"
    There can be two iRule events:
    • PEM_POLICY is triggered when a policy evaluation occurs.
    • RULE_INIT runs the first time the iRule is loaded or has changed.
    The two new PEM iRule commands are PEM::policy initial and PEM::policy name. You can select the Wrap Text check box to wrap the definition text, and select the Extend Text Area check box to increase the field space of format scripts.
  10. From the Frequency list, select a frequency type.
    • Select Always to insert content in each transaction.
    • Select Once to insert content once per action.
    • Select Once Every to insert content once per designated time period, in seconds.
  11. Click Finished.
  12. On the Main tab, click Policy Enforcement > Options .
    The Options screen opens.
  13. For the Content Insertion Options setting, in the Throttling fields, type the time used to set the maximum wait time before Policy Enforcement Manager™ applies the insert action again on the same subscriber.
    Note: The insert actions do not conflict with each other.
You have inserted content in to the HTML pages.