自定义HTTP错误页太小,导致显示默认友好错误页问题
2016-01-07 18:04
866 查看
一 . 问题描述:
chrome 向服务器发送构造字符串,返回错误页面如下
问题来了,最后六行注释是什么鬼?
二 . 为什么会出现这个问题
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错误信息 选项.
*****
参考.
这些配置是在注册表里面的.
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错误信息 选项.
*****
参考.
代码 | 描述 | 文件大小(阈值) |
---|---|---|
400 | Bad Request | > 512 bytes |
403 | Forbidden | > 256 bytes |
404 | Not Found | > 512 bytes |
405 | Method Not Allowed | > 256 bytes |
406 | Not Acceptable | > 512 bytes |
408 | Request Time-out | > 512 bytes |
409 | Conflict | > 512 bytes |
410 | Gone | > 256 bytes |
500 | Internal Server Error | > 512 bytes |
501 | Not Implemented | > 512 bytes |
505 | HTTP Version Not Supported | > 512 bytes |
相关文章推荐
- 模拟QQ侧滑控件 实现三种界面切换效果(知识点:回调机制,解析网络json数据,fragment用法等)。
- 网络请求参数不同却得到相同数据的调查
- c#中Dictionary<object, object>存储网络字符取值问题
- 查看 Apache并发请求数及其TCP连接状态
- Server returned HTTP response code: 500 for URL: http.......错误
- 关于HTTP keep-alive的实验
- SQL Server 2012将数据库备份到网络中的共享文件夹
- (一) 初识HTTP/2
- Android 网络开源库之-retrofit
- http post不使用库,上传带参数的文件时的消息体样式
- http、TCP/IP协议与socket之间的区别
- Android主流网络请求框架Volley
- 使用httpclient上传文件
- AssetsLibrary从网上下载图片,保存到相册,保存网络图片,
- nginx HTTP Upstream模块
- 使用ASIHTTPRequest 编译提示找不到"libxml/HTMLparser.h"的解决方法
- android BroadcastReceiver动态监听网络连接
- TCP滑动窗口机制
- 一次tcp连接被reset的异常故障排查
- HTTP状态码总结