9

We've recently noticed a problem where some user agents would repeat the same POST request without the user actually physically triggering it twice.

After further study, we noticed this only happens when the request goes through our load balancer and when the server took a long time to process the request. A packet capture session eventually revealed that the load balancer drops the connection after a 5 minute timeout by sending a TCP Reset to the client; however, the client automatically resubmitted the request without user intervention.

We observed this behavior in Apache HTTP client for Java, Firefox and IE 8. (I cannot install other browsers to test.) This makes me think this behavior is part of the HTTP standard, but this is not very easy to google.

Also, it seems this only happen if the first request is submitted via a kept-alive TCP connection.

4

1 回答 1

6

这是 HTTP 1.1 协议的一部分,用于处理被服务器过早关闭的连接。

http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.4

我遇到过类似的情况,我们在几毫秒内发布了几次相同的表格。

通过wireshark捕获的数据包确认了浏览器的重新传输,并且来自服务器的日志表明请求的到达。

此外,进一步调查还显示,F5 等负载均衡器报告了重传行为的发生率。因此,也值得与您的负载均衡器供应商核实。

于 2014-05-28T11:16:26.813 回答