Forum Discussion

Zach_01_133944's avatar
Zach_01_133944
Icon for Nimbostratus rankNimbostratus
Aug 16, 2017

Use HTTP::respond and clone together

I am attempting to host a virtual page using HTTP::respond that can have data posted to it, but will still clone that posted data even though HTTP::respond keeps it from ever even going though pool selection.

So I have cobbled together an iRule that checks for a POST and the correct phrase in the URI. If that's all true I collect the data, try to clone it, and then use HTTP::respond to give a 200 message.

The clone infrastructure is working correctly, I just can not clone this traffic I am using HTTP::respond on. Any Ideas on what I cam missing here?

when HTTP_REQUEST {
if {[HTTP::method] eq "POST" && [string tolower [HTTP::path]] contains "abc123" }{
   if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{
      set content_length [HTTP::header "Content-Length"] }
   else { set content_length 1048576 }
   if { $content_length > 0} { HTTP::collect $content_length
   }
   }
} 

when HTTP_REQUEST_DATA {
clone pool abc123
set count [string length [HTTP::payload]]
set response "received a total of $count of a planned $content_length bytes" 
 HTTP::respond 200 content $response 
 }