IE未发送第二个包

目前还未解决这个问题,感觉像是IE的BUG,仅仅是作为一个记录

背景

前端在IE8环境下使用Ajax进行上报数据时,发现有些请求仅有请求头,并没有请求体.
出现的概率比较小,且仅有特定用户反馈.
搜索StackOverflow找到如下:
Why does Internet Explorer not send HTTP post body on Ajax call after failure?

There does not seem to be a clear answer to this question, so I will provide my empirical data as a substitute and provide some ways to work around it. Maybe some MS insider will one day shed some light on this…

If HTTP Keep-Alive is disabled on the server, this issue goes away. In other words, your HTTP 1.1 server will respond to every Ajax request with a Connection: Close line in the response. This keeps IE happy but causes every Ajax request to open a new connection. This can have a significant performance impact, especially on high latency networks.

The issue is triggered easily if Ajax requests are made in rapid succession. For example, we make Ajax requests every 100ms and then the network status changes, the error is easy to reproduce. Although most applications probably do not make such requests, you might well have a couple of server calls happening right after each other which could lead to this problem. Less chatty keeps IE happy.

It happens even without NTLM authentication.

It happens when your HTTP keep-alive timeout on the server is shorter than the default (which defaults to 60 seconds on Windows). Details provided in link in question.

It does not happen with Chrome or Firefox. FF sends one packet so seems to avoid this issue altogether.

It happens in IE 6, 7, 8. Could not reproduce with IE 9 beta.

微软中的提问: Window7 IE 8 如何解决 “AJAX”只发送Header的问题

2021-02-09 更新

查到原因是因为业务前端有个JS和IE8不兼容, 错误消息频繁上报. 导致IE未发送第二个包.
不过令我意外的是营业厅客服反馈加上抓包工具(Wireshark)后就没有出现页面卡死

Author: Sean
Link: https://blog.whileaway.io/posts/23ce7492/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.