Why does IE issue random XHR 408/12152 responses u

2019-02-07 01:32发布

I've just come across a problem relating to IE that there seems to be virtually no documentation about on the 'Net - only a few people asking similar questions.

When I use jQuery (1.4.2) to send a POST request to my server (to which the server responds by sending JSON data), I occasionally get XHR 408 errors (meaning that the server timed out while waiting for the client to finish its request), and (less frequently), XHR 12152 errors (I don't know what these signify). There does not seem to be a pattern to this.

This only occurs in IE (version 8 - I haven't tried other versions, though I can confirm that the problem occurs on two different installations). Safari and Opera seem fine.

This doesn't seem to be a problem with GET requests.

If anyone has any thoughts on the matter, I'd be very grateful.

2条回答
家丑人穷心不美
2楼-- · 2019-02-07 01:57

When you see IE returning things in status that clearly aren't HTTP status codes, they're actually Windows error numbers, typically from WinInet.

12152 ERROR_HTTP_INVALID_SERVER_RESPONSE would seem to confirm the 408's implication that there's a low-level HTTP-syntax problem between your browser and the server. Traditionally this has been a problem with the ActiveX implementation of XMLHttpRequest and keep-alives in HTTPS, but the exact cause is rather murky.

You could perhaps try having the server set Connection: close on XMLHttpRequests that come from IE, see if that helps? This will affect performance, unfortunately.

查看更多
欢心
3楼-- · 2019-02-07 01:57

I solved it by adding "Connection: close" to ajax header also.

There is no need to add "Connection: close" to the response header from the server.

I have tested firing 1,000 requests.

查看更多
登录 后发表回答