Forum Discussion
Nick_Matthews
Cirrus
Aug 21, 2008Search and Replace with iRule
Hi,
I am hoping someone can help.
What I want to do is search in the header for a specific user agent and then find and replace a specific word in the html. Can some one...
Nicolas_Menant
Employee
Aug 21, 2008Sorry i missed this part then you can try something like this:
when HTTP_REQUEST {
set replace_content 0
if {[HTTP::uri] contains "/atoz/"} {
set replace_content 1
}
}
when HTTP_RESPONSE {
if {$replace_content equals "1"} {
Disable the stream filter by default
STREAM::disable
Check if response type is text
if {[HTTP::header value Content-Type] contains "text" and [HTTP::header "User-Agent"] contains "***"}{
Replace
STREAM::expression "@123@xyz@ @456@xyz@"
Enable the stream filter for this response only
STREAM::enable
}
}
}
the variable replace_content can be shared as a local variable among all the events you want. This variable will be available for this TCP connection only
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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