Content Injection

policies/content_injection[]

The gateway can inject content into responses. This entry defines the content and when injection should take place. Content injection is performed based on the request path and a specific location within the response.
This entry is an array and can define multiple content injection points.

Properties

NameTypeConstraintsDescription
namestringA name to be associated with this content injection rule.
pathsArray of stringThe path for which content injection will take place. This entry is an array and can be used to specify multiple paths.
full_line_matchbooleanValues: true or false

Default value: true
Should the location match a full line, or should it match any string in the response? When a full line match is configured the content will be inserted prior to the matching line. When a partial line match is configured the content will be inserted immediately prior to the matching string.
locationstringThe location where the content should be injected. If a full line match is being used the location is pattern matched against a line in the response using the *. wildcard characters. The maximum length of a line which can be matched is 8192 bytes.
replace_matchbooleanValues: true or false

Default value: false
If a partial line match is being used this configuration entry will control whether the matching string is replaced with the supplied content, or whether the supplied content is inserted prior to the matching string. This configuration entry will be ignored if full line matches are being used.
contentstringThe data which is to be injected.

Example

policies:
  content_injection:
    - name: content_injection_1
      paths:
        - "/test"
        - "/test2"
      location: "<h3>*"
      content: |
        <hr/>
        <h4>Add heading4 after heading3</h4>
        <hr/>

Did this page help you?