您的位置:首页 > 理论基础 > 计算机网络

自定义HTTP错误页太小,导致显示默认友好错误页问题

2016-01-07 18:04 866 查看
一 . 问题描述:

  chrome 向服务器发送构造字符串,返回错误页面如下  

<html>
<head>
<title>404 Not Found</title>
</head>
<body bgcolor="white">
<center>
<h1>404 Not Found</h1>
</center>
<hr>
<center>nginx/1.6.2</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->


  问题来了,最后六行注释是什么鬼?

二 . 为什么会出现这个问题

  IEbug #11289 [b] always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression.[/b]

  就是说在浏览器接收到的包比IE设置的阈值小的时候,就不会渲染显示这个包的内容,而是以IE 的内置错误页面来显示,比如联网错误.这样前端就不能正确判断错误类型.

三 . 解决.

  在Internet选项里面去掉 勾选 显示友好HTTP错误信息 选项.

*****

参考.

代码描述文件大小(阈值)
400Bad Request> 512 bytes
403Forbidden> 256 bytes
404Not Found> 512 bytes
405Method Not Allowed> 256 bytes
406Not Acceptable> 512 bytes
408Request Time-out> 512 bytes
409Conflict> 512 bytes
410Gone> 256 bytes
500Internal Server Error> 512 bytes
501Not Implemented> 512 bytes
505HTTP Version Not Supported> 512 bytes
这些配置是在注册表里面的.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: