Forum Discussion
Corinna_Lo_1746
Nimbostratus
Aug 18, 2005https rewrite
hi,
We are trying to put Sakai/OSP behind our BigIPs.
The site is running https.
URL: https://eportfoliodev.wsu.edu/portal
I configured the BigIP to do the SSL, a...
bl0ndie_127134
Aug 19, 2005Historic F5 Account
Hmm, I am a little baffled why it’s not working. I wonder if it’s because you are not setting up your request to HTTP/1.1. Try modifying the rule this way …
when HTTP_REQUEST {
HTTP::version 1.0
}
when HTTP_RESPONSE {
HTTP::collect 4294967295
}
when HTTP_RESPONSE_DATA {
set find " Welcome"
set replace "===============Test Rewrite==============="
set offset 0
set diff [expr [string length $replace] - [string length $find]]
Get indices of all instances of find string in the payload
set indices [regexp -all -inline -indices $find [HTTP::payload]]
puts "Got Payload \n[HTTP::payload]"
if { $indices ne "" } {
puts "iRule: wsu - Search Found $indices"
} else {
puts "iRule: wsu - Search Not Found"
}
foreach idx $indices {
set start [expr [lindex $idx 0] + $offset]
set end [expr [lindex $idx 1] + $offset]
set len [expr {$end - $start + 1}]
replace the instance of find with the contents of replace
HTTP::payload replace $start $len $replace
puts "\nNew Payload \n[HTTP::payload]"
modify offset if the replace string is larger or smaller
than find.
incr offset $diff
}
}
Alternatively, this shorter version of the rule might also do the trick for you.
when HTTP_REQUEST {
HTTP::version 1.0
}
when HTTP_RESPONSE {
HTTP::collect 4294967295
}
when HTTP_RESPONSE_DATA {
set find " Welcome"
set replace "===============Test Rewrite==============="
set payload [HTTP::payload]
if {[regsub -all $find $payload $replace new_response] > 0} {
HTTP::payload replace 0 [HTTP::payload len] $new_response
}
}
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