本文介绍了404 标头 - HTTP 1.0 还是 1.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我能找到的几乎所有示例(包括 this question 来自大约一年前)说当我们真正使用 HTTP 1.1 十多年时,404 标头应该是 HTTP/1.0 404 Not Found?有什么理由不发送 HTTP/1.1 404 Not Found 代替吗?

Why does almost every example I can find (including this question from about a year ago) say that a 404 header should be HTTP/1.0 404 Not Found when we've really been using HTTP 1.1 for over a decade? Is there any reason not to send HTTP/1.1 404 Not Found instead?

(没那么重要……我只是好奇.)

(Not that it matters all that much... I'm mostly just curious.)

推荐答案

HTTP版本的使用可以基于以下几个因素:

The usage of HTTP version can be based on the following factors:

  • 您的网络服务器支持 HTTP 1.0 或 1.1
  • 网络浏览器对 HTTP 1.0 或 1.1 的支持
  • 作为 Web 开发人员,您对使用哪个协议版本的偏好

现代浏览器可以同时支持 1.0 和 1.1,客户端和服务器都会选择同时支持的最高版本.可以找到 2 个协议之间的主要区别:http://www8.org/w8-papers/5c-protocols/key/key.html

Modern browsers can support both 1.0 and 1.1 well, and both the client and server will settle for the highest version both can support together. The key differences between the 2 protocol can be found: http://www8.org/w8-papers/5c-protocols/key/key.html

但是,404 Not Found 的用法没有关键区别.但是,请务必为您的整个网站保持一致.即,如果您使用 HTTP/1.1,您将在整个网站中使用它.

However there's no key differences in the usage of 404 Not Found. However do be consistent for your whole website. i.e. if you use HTTP/1.1, you use it throughout your website.

这篇关于404 标头 - HTTP 1.0 还是 1.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:38