Forum Discussion
Kirk_Bauer_1018
Nimbostratus
Mar 31, 2007Can't get HTTP payload modification iRule to work
I have tried this rule, largely pieced together from sample code on this site:
when HTTP_REQUEST {
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
log local0. "$uri:...
Kirk_Bauer_1018
Nimbostratus
Apr 02, 2007Thanks for your help. I'm able to collect 2750 bytes of data, then call TCP::release and the page displays. However the page still breaks if I actually modify anything. If I comment out the actual replacement command then it works OK (but of course the page is not modified). Here is the code fragment:
when HTTP_RESPONSE_DATA {
log local0. "$uri;$my_id;$time: Entered HTTP_RESPONSE_DATA"
set indices [regexp -all -inline -indices {/intl/en_com/images/logo_plain.png} [HTTP::payload]]
foreach idx $indices {
set start [lindex $idx 0]
set end [lindex $idx 1]
set len [expr {$end - $start + 1}]
log local0. "$uri;$my_id;$time: Found String, len=$len"
HTTP::payload replace $start $len "http://kaybee.org:8080/google_f5.png"
}
HTTP::release
}
So this code works since the replacement line is commented out. And I see the log entry showing it found a match. So what could be wrong with my replace command?
Thanks in advance!
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