ngkin2010
Apr 14, 2020Nimbostratus
Effect of Rewriting HTTP Response
Hi mates,
I have write a simple F5 iRule to rewrite the HTTP response on LTM.
The code is simple:
when HTTP_RESPONSE {
if [HTTP::header "Content-Length"] > 50000000 {
HTTP::header replace "Content-Type" "text/html"
HTTP::header remove "Content-Disposition"
HTTP::payload replace 0 [HTTP::payload length] ""
HTTP::respond 503 content "Access Denied"
}
}
It does work when testing. But I am not quite sure about the mechanism behind to evaluate the impact.
Obviously the above code is mean to check if response payload size is larger than 50MB, and rewrite the HTTP content.
But what will happen when user is trying to download file larger than 50MB?
- User sending HTTP GET REQUEST to F5
- F5 pass it to Server
- Server received the HTTP REQUEST
- Server send the HTTP RESPONSE with Content-Length larger than 50000000 to F5
- F5 received the HTTP RESPONSE, and according to iRule it rewrites the content to "text/html" and send it to User
- User receive and display the HTTP text/html page
- User replying TCP ACK to F5
- F5 received TCP ACK
- (What will happen next?)
Will F5 sending TCP ACK / TCP RST to server and why?
In the view of server side, it has no idea that F5 rewrote the HTTP RESPONSE, and potential impact at server side? (e.g. the HTTP session is on-hold until timeout)
Thanks.