4xx-客户端错误

title

4xx 这类状态代码这些状态代码表示请求可能出错,妨碍了服务器的处理。例如,客户端请求不存在的页面,客户端未提供有效的身份验证信息。

HTTP 4xx 状态码表示客户端发送的请求有误或无法被服务器理解,因此服务器无法处理请求。

以下是一些常见的 HTTP 4xx 状态码及其含义:

其中 402 暂时未使用,需要注意的是,客户端错误状态码并不表示服务器出错,而是客户端请求有误。

Client Error 4xx

   The 4xx class of status code is intended for cases in which the
   client seems to have erred. Except when responding to a HEAD request,
   the server SHOULD include an entity containing an explanation of the
   error situation, and whether it is a temporary or permanent
   condition. These status codes are applicable to any request method.
   User agents SHOULD display any included entity to the user.

   If the client is sending data, a server implementation using TCP
   SHOULD be careful to ensure that the client acknowledges receipt of
   the packet(s) containing the response, before the server closes the
   input connection. If the client continues sending data to the server
   after the close, the server's TCP stack will send a reset packet to
   the client, which may erase the client's unacknowledged input buffers
   before they can be read and interpreted by the HTTP application.

所有的4xx错误码

代码 说明 解释
400 Bad Request 错误请求,服务器不理解请求的语法。
401 Unauthorized 未授权,请求要求身份验证。 对于需要登录的网页,服务器可能返回此响应。
402 Payment Required 付费内容请求,为以后保留的。
403 Forbidden 禁止,服务器拒绝请求。
404 Not Found 未找到,服务器找不到请求的网页。
405 Method Not Allowed 方法禁用,禁用请求中指定的方法。
406 Not Acceptable 不接受,无法使用请求的内容特性响应请求的网页。
407 Proxy Authentication Required 需要代理授权,此状态代码与 401(未授权)类似,但指定请求者应当授权使用代理。
408 Request Timeout 请求超时,服务器等候请求时发生超时。
409 Conflict 冲突,服务器在完成请求时发生冲突。 服务器必须在响应中包含有关冲突的信息。
410 Gone 已删除,如果请求的资源已永久删除,服务器就会返回此响应。
411 Length Required 需要有效长度,服务器不接受不含有效内容长度标头字段的请求。
412 Precondition Failed 未满足前提条件,服务器未满足请求者在请求中设置的其中一个前提条件。
413 Request Entity Too Large 请求实体过大,服务器无法处理请求,因为请求实体过大,超出服务器的处理能力。
414 Request-URI Too Long 请求的URI过长,请求的 URI(通常为网址)过长,服务器无法处理。
415 Unsupported Media Type 不支持的媒体类型,请求的格式不受请求页面的支持。
416 Requested Range Not Satisfiable 请求范围不符合要求,如果页面无法提供请求的范围,则服务器会返回此状态代码。
417 Expectation Failed 未满足期望值,服务器未满足"期望"请求标头字段的要求。

更多4xx

powered by Gitbook© 2023 编外计划 | 最后修改: 2023-11-24 03:36:58

results matching ""

    No results matching ""