我想了解在自定义错误消息的情况下,浏览器和服务器之间的通信是如何工作的。
我了解一个301/302标题,其中包含相关页面的url,
HTTP/1.1 30x .... Location: http://www.example.org/
但404头没有(据我所知)。
什么告诉浏览器去获取错误页面? 我没有networking嗅探器,问题本身在谷歌上产生了大量的噪音
这是我跟踪http:
GET http: //myserver.com/unknownpage HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: en-gb User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET4.0C; .NET4.0E) Accept-Encoding: gzip, deflate Proxy-Connection: Keep-Alive Host: myserver.com Cookie: ... HTTP/1.1 404 Not Found Date: Wed, 30 Jan 2013 08:54:52 GMT Server: Apache Content-Type: text/html;charset=ISO-8859-1 Transfer-Encoding: chunked Proxy-Connection: Keep-Alive Connection: Keep-Alive GET http: //myserver.com/errorpages/error404.htm HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: en-gb User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET4.0C; .NET4.0E) Accept-Encoding: gzip, deflate Proxy-Connection: Keep-Alive Host: myserver.com Pragma: no-cache Cookie: ... HTTP/1.1 200 OK Date: Wed, 30 Jan 2013 08:54:52 GMT Server: Apache Last-Modified: Tue, 22 Jan 2013 16:14:07 GMT Accept-Ranges: bytes Content-Type: text/html Content-Length: 5958 Proxy-Connection: Keep-Alive Connection: Keep-Alive Age: 0
所以我的问题是什么告诉浏览器去获取自定义页面? 我知道如何在Apache上进行设置,我的问题只是关于通信
对于每个特定的HTTP错误代码,Web服务器只需将configuration的页面返回给浏览器即可。
实际上,您将replace默认页面,以防出现特定错误。