Forum Discussion
Eduardo_Saito_1
Nimbostratus
Jan 09, 2009Modifying HTTP REQUEST DATA
Hello guys.
Every iRule I've made that need to access HTTP_RESPONSE_DATA I used the following code:
when HTTP_REQUEST {
No Chunk
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000000
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
when HTTP_RESPONSE_DATA {
log local0. "[HTTP::payload]"
HTTP::release
}
But now I have to access the HTTP_REQUEST_DATA instead. The irule I've made looks like this one:
when HTTP_REQUEST {
No Chunk
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
Colect Content_length
set clen [HTTP::header Content-Length]
if { not [info exists clen] or "" eq $clen } {
set clen 1000000000
}
HTTP::collect $clen
}
when HTTP_REQUEST_DATA {
log local0. "[HTTP::payload]"
HTTP::release
}
It is working for the majority of the customers but some customers are complaining about not being able to reach WebServices (SOAP/XML). Their logs show connection reset.
The question is: Do I have to make a HTTP::version check at the HTTP_REQUEST even though I'm just interested in the HTTP_REQUEST_DATA? What might be the problem here?
Thanks for helping me.
- hoolio
Cirrostratus
When the TCP reset is sent to the client, do you see a TCL error logged to /var/log/ltm? If not, can you add logging to the iRule to see which event the reset is being sent during? - Eduardo_Saito_1
Nimbostratus
Thanks for the reply hoolio.when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr] equals 200.200.200.200] } { log local0. "Just the client I want to debug: 200.200.200.200." set debug 1 } } when HTTP_REQUEST { No Chunk if { [HTTP::version] eq "1.1" } { if { [HTTP::header is_keepalive] } { HTTP::header replace "Connection" "Keep-Alive" } HTTP::version "1.0" } Colect Content_length set clen [HTTP::header Content-Length] if { not [info exists clen] or "" eq $clen } { set clen 1000000000 } HTTP::collect $clen } when HTTP_REQUEST_DATA { if { $debug == 1 }{ log local0. "Here comes the HTTP REQUEST PAYLOAD for 200.200.200.200..." log local0. "[HTTP::payload]" } HTTP::release } when HTTP_RESPONSE { if { [HTTP::header exists "Content-Length"] } { set content_length [HTTP::header "Content-Length"] } else { set content_length 1000000000 } HTTP::collect $content_length } when HTTP_RESPONSE_DATA { if { $debug == 1 }{ log local0/ "Here comes the HTTP RESPONSE PAYLOAD for 200.200.200.200..." log local0. "[HTTP::payload]" } HTTP::release } when CLIENT_CLOSED { if { $debug == 1 }{ log local0. "Client 200.200.200.200 getting disconnected..." } }
- hoolio
Cirrostratus
It would add significant overhead to collect the request/response for every client if you only want to log the payloads for one client. You should check if debug is set to 1 before modifying the version or collecting.
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