Forum Discussion
keefyweefy
Mar 24, 2011Nimbostratus
simple stream replace not working
Hi Guys,
I'm trying to replace text within webpages but things
arn't going to plan! As a result i've stripped this to be as simple as
possible but still no joy. I've tried doing this two w...
Michael_Yates
Mar 24, 2011Nimbostratus
If you are going to use a Stream Profile in an iRule you need several things.
1. A Blank Stream Profile (create a stream profile, name it, and save it with the options empty)
profile stream blank.stream.profile {
defaults from stream
}
2. An HTTP Profile (Suggest building a Custom Profile for using a Stream Profile with an iRule) that has "Response Chunking" set to "Rechunk"
3. The iRule. This is also the way that you can "Overload" a Stream Profile to do multiple replacements (You can do it to a normal stream profile as well, but you have to totally do it command line).
Base iRule:
when HTTP_RESPONSE {
STREAM::disable
STREAM::expression "@Hello@45678@ @Goodbye@12345@"
STREAM::enable
}
}
Need an exception to the Stream Profile? It requires two parts. HTTP_REQUEST sets the variable for the HTTP_RESPONSE to use:
when HTTP_REQUEST {
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
STREAM::disable
STREAM::expression "@Hello@45678@ @Goodbye@12345@"
if { !($uri contains "somefile.xml") || !($uri contains "/some/folder/") } {
STREAM::enable
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects