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...
Corinna_Lo_1746
Nimbostratus
Aug 19, 2005Thanks for your quick response. Meantime, while searching, I also found this great post:
http://devcentral.f5.com/default.aspx?tabid=28&view=topic&forumid=5&postid=3410
I followed that example, and set find "http://eportfoliodev.wsu.edu",
and replace "https://eportfoliodev.wsu.edu"... but it doesn't work for me... i turned on logging, and tried to do some trouble-shooting - simply try to replace "Welcome" wording to "===============Test Rewrite===============". And I found some inconsistent behaviour.
As you can see from this URL:
https://eportfoliodev.wsu.edu/portal
Their should be 5 "Welcome" there on that page (4 of them in the content, and 1 in the page title). But only 2 of them are successfully being replaced.
My code is as follows:
when HTTP_RESPONSE {
collect response data
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 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]]
if { $indices ne "" } {
log user.notice "iRule: ePortfolioDev - Search Found $indices"
} else {
log user.notice "iRule: ePortfolioDev - 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
modify offset if the replace string is larger or smaller
than find.
incr offset $diff
}
}
My question is, if searching inside the HTTP::payload does not find all occurence of a string... where else can I search for?
Again, any help is very much appreciated.
- corinna
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