Kemp Support, how can we help?

The latest application delivery knowledge and expertise at your fingertips.

How To Create Response Body Modification Content Rules

To create rules to modify the contents of the HTTP message body, your LoadMaster must be on firmware 7.2.39.0 or later.

The HTML page that is having its Body modified should be larger than 512 bytes.

The LoadMaster reads the response from the server on a line by line basis and must be received uncompressed from the server.  However, the Accept-Encoding header can be removed at the LoadMaster with a Content Rule.

The server HTTP response received by the LoadMaster will need to be a 200 OK for response body modifications to work. 

Input lines can have a maximum length of approximately 64K bytes.

Response Body String Replacement Rule

To create the Response Body String Replacement Rule navigate to Rules & Checking > Content Rules > & Click Create New:

  1. Set the Rule Type to Replace String in Response Body.
  2. Create a Rule Name.
  3. Input the string to be matched into the Match String field.

               Match String: /http:\/\//

  1. Input the string to replace the string matched into the Replacement Text field.

               Replacement Text: https://

  1. Click Create Rule.

Figure 1.1 - Response Body String Replacement Rule

ResponseBody_Rule.png

  1. Apply the rule under VS > Advanced Properties > Response Body Modification

 

Here is an example of how we can fix “mixed content” errors on a page.

Figure 1.2 – Web Page Before Configuring Response Body Modification Content Rules

MixedContent.png

Notice that in Figure 1.2 there is a “Connection is Not Secure” error because the image within this secure https page is a unsecure http image and classifies as Mixed Content.

In Figure 1.3 the Response Body Modification Content Rules have been applied and the content on the page is secure.

Figure 1.3 - Web Page After Configuring Response Body Modification Content Rules

 MixedContentFixed.png

**If the server is giving a compressed response, you can delete the Accept-Encoding header that is sent by the client.

 

Navigate to Rules & Checking > Content Rules > & Click Create New:

  1. Set the Rule Type to Delete Header.
  2. Create a Rule Name.
  3. Input Accept-Encoding into the Header Field to be Deleted field.
  4. Click Create Rule.

 Figure 1.4 – Accept-Encoding Header Deletion

 Accept-Encoding_Rule.png

Applying The Accept-Encoding Header Deletion Rule To A Virtual Service

To apply the Accept-Encoding Header Deletion content rule, navigate to Virtual Services > View/Modify Services > click Modify > Advanced Properties > HTTP Header Modifications and add the Accept-Encoding Header Deletion content rule as a request rule.

Figure 1.5 – Applying The Accept-Encoding Header Deletion Request Rule

Accept-Encoding_Request_Rule.png


Was this article helpful?
0 out of 0 found this helpful

Comments