Manual Chapter :
Content Profiles
Applies To:
Show VersionsBIG-IP APM
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP Analytics
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP LTM
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP PEM
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP AFM
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP DNS
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
BIG-IP ASM
- 15.1.10, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0
Content Profiles
Introduction to HTML content modification
When you configure an HTML profile on the BIG-IP system, the system can
modify HTML content that passes through the system, according to your specifications. For
example, if you want the BIG-IP system to detect all content of type
text/html
and then remove all instances of the HTML img
tag with the src
attribute, you can configure an HTML profile accordingly, and assign it to the virtual server.
The HTML profile ensures that the BIG-IP system removes those instances of the tag from any HTML
content that passes through the virtual server.Or, you can configure an HTML profile to match on a certain tag and attribute in HTML content
when a particular iRule event is triggered, and then create an iRule that includes a command to
replace the value of the matched attribute with a different attribute. The BIG-IP system includes
several iRule commands that you can use when the
Raise Event on Comment
or
Raise Event on Tag
events are triggered. For more information on iRule commands
related to HTML content modification, see the F5 Networks web site
http://devcentral.f5.com
.HTML tag removal and replacement are just two of several HTML rules that you can configure to
manipulate HTML content. An
HTML rule
defines the specific actions that you want the
BIG-IP system to perform on a specified type HTML content.About content selection types
When you create an HTML type of profile, you can specify the type of content that you want the
BIG-IP system to match on when determining which content to modify.
The types of content that you specify must be valid values for the
Content-Type
header of an HTTP response.Typical
Content-Type
header values that you can specify are:- text/html
- text/xhtml
- text/xml
- text/javascript
You must specify at least one valid content type if you want the BIG-IP system to match content based on an HTML rule that you create.
Types of HTML rules
You can create several different types of HTML rules for modifying HTML content.
HTML rule type | Description |
---|---|
Remove Comments | Removes comments within HTML content. There are no matching and no actions associated with this type of HTML rule. |
Raise Event on Comments | Raises an HTML_COMMENT_MATCHED iRule event. There are no matching and no actions associated with this type of HTML rule. |
Remove Attribute | Matches on the specified tag name, attribute name, and attribute value, and then removes
the HTML tag attribute. |
Append HTML | Matches on the specified tag name, attribute name, and attribute value, and then appends the
specified HTML content to the tag delimiter. |
Prepend HTML | Matches on the specified tag name, attribute name, and attribute value, and then prepends
the specified HTML content to the tag delimiter. |
Raise Event on Tag | Raises an HTML_TAG_MATCHED iRule event. With this type of rule, you can match on the tag name, attribute name, and attribute value. |
Remove Tag | Matches on the specified tag name, attribute name, and attribute value, and then removes
the HTML tag. |
Sample HTML rules configuration
When you create an HTML rule, you can specify the actions that you want the BIG-IP system to take based on that type of rule. The actions you specify vary depending on
the type of HTML rule you are creating.
For example, suppose you want to replace this HTML content:
<img src="image/bigip8900.jpg"/>
with:
<img src="image/bigip8900.png"/>
To do this, you can create an HTML profile with a content selection type of
text/html
and the Raise Event on Tag
rule.In the example, the
Raise Event on Tag
rule specifies these match settings:Tag name: | img |
---|---|
Attribute name: | src |
Attribute value: | image/bigip8900.jpg |
These settings instruct the BIG-IP system to match on any <img> tag that includes the
src
attribute and the attribute value
image/bigip8900.jpg
.After creating the HTML profile, you can write an iRule that specifies the
HTML_TAG_MATCHED
event, as well as the HTML::tag attribute
replace
command, which specifies the new attribute value. When the traffic reaches the
virtual server, the BIG-IP system triggers the event, matches on the tag and attribute specified
in the HTML rule, and replaces the old attribute value with the new value specified in the
iRule.