Skip to main content

Content Injection

Description

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

The following table(s) describe the configuration properties for this component:

Name Type Constraints Description
content string The data which is to be injected.
paths array[string] The path for which content injection will take place. This entry is an array and can be used to specify multiple paths.
name string A name to be associated with this content injection rule.
full_line_match boolean Values: true,false
Default: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.
location string The 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_match boolean Values: true,false
Default: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.

Example

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