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 t...
hoolio
Cirrostratus
Nov 17, 2006A bit late, but...
I was trying to figure out how to insert a Content-length header in the TCP response data before TMM processed the HTTP headers. I came up with the following which seems to work:
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]"
}
}
Aaron
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