Forum Discussion
Frank_J_104756
Oct 31, 2007Historic F5 Account
HTTP::payload replace
I have 2 needs...1 to replace/hide the server in the http redirects that are being sent by the node. 2) to replace/hide the server in the actual content.
when HTTP_RESPONSE {
if...
hoolio
Cirrostratus
Oct 31, 2007There is an example showing how to replace a string in a payload on the HTTP::payload page (Click here) which uses regsub -all. I suppose you could use string map for a more efficient replacement if don't need a regex to describe the search string(s).
Something like this...?
when HTTP_RESPONSE {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
when HTTP_RESPONSE_DATA {
regsub -all "oursite" [HTTP::payload] "oursitedev" newdata
log "Replacing payload with new data."
HTTP::payload replace 0 $content_length [string map {oursite oursitedev} [HTTP::payload]}]
HTTP::release
} Out of curiosity, do you have any idea of why the stream profile isn't working? What version are you running?
Aaron
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
