Forum Discussion
Ken_Wong_48678
Jun 14, 2006Historic F5 Account
insert http header in tcp payload
Hi,
For some reasons, I need to insert a http header before LTM start to inspect http header and content. So, I try to insert the header in client data.
I can insert a header at the 0 offset using below irule, but I do not know how to insert in the middle of the payload. Is there anyone know how to get the offset in the payload? Thanks in advanced
Regards,
Ken
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
TCP::payload replace 0 0 "header: value "
set new_pl [TCP::payload]
log local0. "new_pl"
TCP::release
}
- hoolio
Cirrostratus
A bit late, but...when HTTP_REQUEST { if it's a HEAD request, set a variable to reference in SERVER_DATA event if { [HTTP::method]=="HEAD" }{ set request_is_head 1 log local0. "head" } } when SERVER_CONNECTED { if request was a head, collect the TCP data if { [info exists request_is_head] and $request_is_head==1 }{ log local0. "collecting" TCP::collect 15 } } when SERVER_DATA { if request was a head, insert a content-length header with a value of 0 if { [info exists request_is_head] and $request_is_head==1 }{ log local0. "payload before: [TCP::payload]" log local0. "index: [string first "\r\n\r\n" $server_payload]" TCP::payload replace [string first "\r\n\r\n" [TCP::payload]] 0 "\r\nContent-length: 0" log local0. "payload after: [TCP::payload]" } }
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