Customising Headers and Body Responses
In this tutorial you will learn how to alter headers body responses within a request rule. This will cover the ability to do the following:
- Set headers
- Clear headers
- Remove headers
- Preserve origin status
- Replace body
Setting Headers
When building a request rule, the option to ‘Add Header’ can be found under the ‘Modify Response’ menu.
Adding this into the flow of a request rule will prompt you to input details for the header you wish to alter, in the form of a key:value pair.
Enter the details relevant to your rule, and click Save. This will update the values of the named Response Headers. Other actions can be added to the request rule after ‘Add Header’.
Clearing Headers
When building a rule, the option to ‘Clear headers’ can be found under the ‘Modify Response’ menu.
Adding this into the flow of a request rule will mean that all origin response headers for the site user are cleared, at the point that users reach this part of the rule.
When building a rule, the option to ‘Clear headers’ can be found under the ‘Modify Response’ menu.
Adding this into the flow of a request rule will mean that all origin response headers for the site user are cleared, at the point that users reach this part of the rule.
Removing Headers
When building a request rule, the option to ‘Remove Header’ can be found under the ‘Modify Response’ menu.
Adding this into the flow of a request rule will prompt you to input details for the header you wish to remove.
Enter the details relevant to your rule, and click Save.
Other actions can be added to the request rule after ‘Remove Header’.
Preserving Origin Status
When building a request rule, the option to ‘Preserve Origin Status’ can be found under the ‘Responses’ menu.
Adding this into the flow of a request rule will ensure the the response code, headers and body of the origin’s response remain unchanged.
No further actions can be added to the request rule after ‘Preserve Origin Status’.
Replace Body
When building a request rule, the option to ‘Replace Body’ is available under the ‘Modify Response’ menu.
Adding this into the flow of a request rule will prompt you to input details for the Body value that you wish to replace.
Enter the details relevant to your rule, and click Save.
Other actions can be added to the request rule after ‘Replace Body’. This will replace the body on the original response.