Forum Discussion

João_Assad_4295's avatar
João_Assad_4295
Icon for Nimbostratus rankNimbostratus
Nov 14, 2005

redirect POSTs bigger than 1MB

Hello,

I'd like to redirect POSTs bigger than 1MB to an error page, so I tried this:


when HTTP_REQUEST {
   set method [HTTP::method]
   set clen [HTTP::header Content-Length]
   if { $method =="POST" and $clen > 1048576 } {
      log local0. "over 1MB post: $uri - ($clen) [IP::client_addr]"
      HTTP::respond 301 "Location" "http://[HTTP::host/errorpage.htm"
   }
}

The problem with that is that it will only redirect after the whole POST is sent to the server, I'd like the iRule to interrupt the client and redirect it to the error page immediately.

So I tried adding HTTP::close or TCP::close after the HTTP::respond, but then I got "Document contains no data" errors on the client.

So, Is there a way to make this work ?

Thanks.

15 Replies