cancel
Showing results for 
Search instead for 
Did you mean: 

Problem this snippet solves:

This iRule inserts content into a server response using HTTP::payload replace.

There are lots of examples of using HTTP::payload replace to substitute content in a server response. It can also be used to add content to the payload.

One requirement is that you add response rechunk to the http profile.

Code :

profile http profile-http-test {
  defaults from http
  response rechunk
}

# This example adds text, in the form of an HTML comment, to the payload sent to the client. The text could could easily be a variable set during the execution of the iRule.

when HTTP_RESPONSE {
  # Insert HTML comment to the top of the payload.
  HTTP::payload replace 0 0 ""
}

# Question: Don't you have to collect the HTTP data first using HTTP::collect before calling HTTP::payload replace in the HTTP_RESPONSE_DATA event? -Aaron
Version history
Last update:
‎18-Mar-2015 12:03
Updated by:
Contributors