Forum Discussion
João_Assad_4295
Nimbostratus
Nov 14, 2005redirect 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.
- James_Thomson
Employee
You might need to collect the data with an http::collect. I think this will stop the BIG-IP from sending the bits and pieces to the server. - drteeth_127330Historic F5 AccountAre you sure the whole POST is going to the server? HTTP::respond is supposed to sink the POST data without sending it on. What version of BIG-IP are you running?
- João_Assad_4295
Nimbostratus
I tried:HTTP::collect $clen
HTTP::collect 1
HTTP::collect
- unRuleY_95363Historic F5 AccountYou could try adding a "reject" after the HTTP::respond. This should reset the connection after responding which should stop the client from sending more of the post data (where not quite sure what you are trying to accomplish). The BIGIP should discard the data after you respond. Is the problem that the BIGIP doesn't respond until after the entire post arrives at the BIGIP and the client browser times out before then?
- João_Assad_4295
Nimbostratus
adding a "reject" after the HTTP::respond gives the same "Document contains no data" - unRuleY_95363Historic F5 AccountI just looked closer at your HTTP::respond command and it looks like you might be having an error:
HTTP::respond 301 "Location" "http://[HTTP::host/errorpage.htm"
- João_Assad_4295
Nimbostratus
ah my bad, It is correct on the BigIP.. I just messed up the post here. - João_Assad_4295
Nimbostratus
Still can't make this work. - drteeth_127330Historic F5 AccountBIG-IP has no support for early responses at this time. It's also worth mentioning that even if BIG-IP did send the early response, there's no guarantee that the client will pay any attention.
- Jari_Hyttinen_1
Nimbostratus
Hi,
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