Forum Discussion
John_Reeman_470
Nimbostratus
Jun 17, 2005SOAP rewrite
I have SSL traffic coming into the BIGIP and being decrypted and forwarded to an HTTP server pool. Unfortunately the SOAP clients which are connecting in are entering the following in their XML 'https...
Jun 17, 2005
What you are doing looks correct aside from the offset value in the HTTP::payload replace command
HTTP::payload replace offset length new_string
You are passing in a value of 16 for length when I believe it should be the length of "To>https://" which is 11.
You cannot reliably do this in the HTTP_REQUEST method because at this point the content is not guaranteed to be received yet. You must use the HTTP::collect method in HTTP_REQUEST to ensure that the amount of content you requested is received. After a HTTP::collect method is called, the HTTP_RECEIVE_DATA event is raised and you can then access the HTTP::payload at that time.
You can do this in one big chunk (up to [HTTP::header Content-Length]) or at little pieces at a time with successive calls to HTTP::collect.
Another issue with your original code could be that the header isn't in the first 1024 bytes of the request. It's better to request the entire Content-Length (unless it's huge).
In your case, I would do something like the following:
when HTTP_REQUEST {
set clen [HTTP::header Content-Length]
if { not [info exists clen] or "" eq $clen } {
set clen 4096
}
HTTP::collect $clen
}
when HTTP_REQUEST_DATA {
set old_content "To>https://"
set new_content "To>http://"
set len_old_content [string length $old_content]
set offset [string first $old_content [HTTP::payload]]
if { $offset >= 0 } {
log local0. "Found '$old_content' in payload at offset $offset"
log local0. "Content Before: [HTTP::payload]"
HTTP::payload replace $offset $len_old_content $new_content
log local0. "Content After : [HTTP::payload]"
} else {
log local0. "Didn't find '$old_content' in payload!"
log local0. "Payload: [HTTP::payload]"
}
}
The log statements will put the payload before and after the replace in the /var/log/ltm file. This should help with troubleshooting if things don't work.
-Joe
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