Forum Discussion
Wes_98712
Nimbostratus
Mar 30, 2007rewrite HTML in response
Interesting dilemma we have here. We are about to release a new version of a site we own, but don't have time to change the HTML on a particular page, essentially the hyperlink points to site that wi...
Wes_98712
Nimbostratus
Mar 30, 2007Something like as follows right?
Taken from the creditcard scrubber.
when HTTP_RESPONSE {
if { $scrub_content } {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 4294967295
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
when HTTP_RESPONSE_DATA {
set old_link "www.somedomain.com/someuri"
set new_link "www.somedomain1.com/somenewuri"
if { [regsub -all {$old_link} [HTTP::payload] $new_link newdata] } {
log "Replacing $old_link with $new_link"
HTTP::payload replace 0 [HTTP::payload length] $newdata
} else {
log "replacing nothing"
}
} I think the issue is that I am not replacing the string correctly, the regsub seems like it should work, if it matches the old_link in the payload, replace etc. But I think I am off target.
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
