This article refers to firmware 3.1 and higher, running on a Barracuda Load Balancer 340 or higher.
Response Body Rewrite rules apply to Layer 7 - HTTP Services only.
This article assumes you have a Google® Analytics™ account to obtain the code for use in the response body.
Response Body Rewrite Rules
Google Analytics Example
This example describes how to offload Google indexing by inserting Google Analytics code into the responses by looking for a unique text string, for example, </html> or Copyright, guaranteed to appear in a page only once, for search and replace to avoid duplication.
In this example, for the response body rewrite, the Google Analytics code is inserted into the responses by the 'string' guaranteed to be present in every page, which is then replaced with the 'string' + 'Google Analytics code'.
To create the rule, complete the following steps:
- Log into the Barracuda Load Balancer as the administrator, and go to the WEBSITES > URL Rewrites page.
- Go to the Response Body Rewrite section. In the Rule Name field enter a name for the rule, for example:
- In the Rule Order field, enter the order of execution if there is more than one rule. Range: 1 to 128, where 1 is executed first.
- In the Host Match field, Enter * which will be used to match the hostname field in the request header.
- In the URL Match field, enter /* which will be used to match the URL field in the request header. This value means that the ACL applies for all URLs in that domain.
- In the Search String field, enter the unique text string to be searched, for example: </html>
- In the Replace String field, enter the Google Analytics code followed by the search string, for example:
- Click Add.