专栏首页运维之美HTTP 故障图解指南

HTTP 故障图解指南

网页打开某个网站,可以看到正常的内容,这个 HTTP Status code200,没有显示在页面上。

但是偶尔会看到整页白底,但是上面写 400403500,或者画面比较好看的 404 此页面找不到等等,那这些代码是什么意思呢?

做为一个运维工程师,遇到这样的情况,你又应该怎么判断是哪里出问题了呢?

1HTTP 状态代码决策图

对于超文本传输协议(又称 HTTP 状态代码),代码的第一个数字表示五类响应中的一类。HTTP 客户端至少要认识这五类。

第一类代码是信息性的,表示在继续处理时的临时响应。第二类状态代码传达了客户的请求被接收并成功处理。第三类 HTTP 状态代码表明,为了完成请求,需要代表客户采取进一步的行动,如 URL 重定向。第四类代码是在客户出错时使用的。第五类状态代码表示服务器出了错误,无法完成一个明显有效的请求。

1xx Informational

100 - Continue

The server has received the initial request, and the client should continue sending the remainder of the request.

101 - Switching Protocols

The server is acknowledging that it is switching protocols based on the requesterÕs instructions.

102 - Processing Request (WebDAV; RFC 2518)

To avoid timing out, the server acknowledges that a request has been received and is being processed, though no response is available.

103 - Checkpoint

Resumes aborted PUT or POST requests in Resumable HTTP Requests Proposal.

122 - Too Long

An IE7-only code that indicates that the URI is longer than the maximum 2,083 characters.

200 - OK

The standard response for successful HTTP requests. Varies according to request method. For GET requests, responses contain an entity corresponding to the requested resource. For POST requests, responses contain an entity describing or containing the result of the action.

201 - Created

The request has been fulfilled, resulting in the creation of a new resource.

202 - Accepted

The request has been accepted, but processing is still pending. Upon processing, the request might be disallowed, meaning it might or might not actually be acted upon.

203 - Non-Authoritative Information (since HTTP/1.1)

The request has been successfully processed by the server, but the information being returned may be from another source.

204 - No Content

The request has been successfully processed by the server, but no content is being returned. Often a successful delete request.

205 - Reset Content

Though the request was successfully processed, no content is being returned and the requester must reset the document view.

206 - Partial Content (RFC 7233)

Because of the range header sent by the client, only part of the resource is being delivered by the server.

207 - Multi-Status (WebDAV; RFC 4918)

Depending on the number of sub-requests made by the client, the XML message that follows might contain multiple separate response codes.

208 - Already Reported (WebDAV; RFC 5842)

The results have been included in a previous reply and are not being returned again.

226 - IM Used (RFC 3229)

A request for this resource has been fulfilled by the server. The response represents the result of one or more instance manipulations for the current instance.

2xx Success

300 - Multiple Choices

Indicates multiple options for the resource delivered, such as format options for video or list files with different extensions. The user can select preferred representation and redirect the request to that location.

301 - Moved Permanently

This request and all future ones should be directed to the given URI.

302 - Found

Indicates that the requested resource can be found temporarily via an alternative URI. Because many popular user agent implementations treat 302 responses similar to 303 responses, both status codes 303 and 307 were added to allow servers more specificity.

303 - See Other (since HTTP/1.1)

Indicates the response to the request can be found via alternative URI using GET method. Many pre-HTTP/1.1 user agents do not recognize 303, in which case the 302 status code can be used instead.

304 - Not Modified (RFC 7232)

Indicates that the resource has not been modified since last requested, and there is no need to retransmit as the client has a previously downloaded copy.

305 - Use Proxy (since HTTP/1.1)

Requested resource is located elsewhere and can be accessed through a proxy provided in the response. For security reasons, HTTP clients like Firefox and Internet Explorer do not correctly handle 305 responses.

306 - Switch Proxy

Originally indicated that subsequent requests should use the proxy specified. This status code is no longer used.

307 - Temporary Redirect (since HTTP/1.1)

Indicates that the request should be repeated with a different URI as specified, but future requests should use the original URI.

308 - Permanent Redirect (RFC 7538)

This and all future requests should be repeated using a different URI as specified. Unlike 301 and 302, with 307 and 308 status codes the HTTP method should not change.

3xx Redirection

400 - Bad Request

The request cannot be processed by the server because of a client error such as syntax, framing, or routing.

401 - Unauthorized

Indicates that authentication is required and was either not provided or has failed. If the request already included authorization credentials, then the 401 status code indicates that those credentials were not accepted.

402 - Payment Required

Reserved for future use. Originally intended to be part of a digital cash or micropayment model, this code is not currently widely used.

403 - Forbidden

Indicates that though the request was valid, the server refuses to respond to it. Unlike the 401 status code, providing authentication will not change the outcome.

404 - Not Found

Indicates that the requested resource could not be found but may be available in the future.

405 - Method Not Allowed

The request method is not supported by the resource requested, as when using GET on a form that requires data to be presented via POST.

406 - Not Acceptable

The requested content is not acceptable according to the requestÕs Accept headers.

407 - Proxy Authentication Required (RFC 7235)

The client must first authenticate itself with the proxy.

408 - Request Timeout

Indicates that the server timed out while waiting for the request, though the client may repeat the request without modifications.

409 - Conflict

There is a conflict in the request that prevents it from being processedÑfor example, an edit conflict in the case of multiple updates.

410 - Gone

The requested resource is no longer available and will not be available again, as when a resource has been intentionally removed and should be purged. The client should not request the resource again.

411 - Length Required

The request did not specify the length of its content, though length is required by the requested source.

412 - Precondition Failed (RFC 7232)

Indicates that the server does not meet the request preconditions as specified by requester.

413 - Request Entity Too Large

Indicates that the request is larger than the server can or will process.

414 - Request-URI Too Long

The provided URI was too long to be processed by the server. When resulting from too much data encoded as GET request query-string, convert to a POST request.

415 - Unsupported Media Type

The server does not support the media type included by the request entity.

416 - Requested Range Not Satisfiable (RFC 7233)

Indicates that the client has requested a portion of the file that the server is unable to provide, such as a part of the file that lies beyond the end of the file.

417 - Expectation Failed

Indicates that the server is unable to meet the requirements of Expect request-header field.

418 - I'm a teapot (RFC 2324)

Defined in 1998 as a traditional IETF April FoolÕs joke and is not expected to be implemented by actual HTTP servers. The RFC specifies that this code should be returned by teapots requested to brew coffee.

419 - Authentication Timeout (not in RFC 2616)

Indicates that previously valid authentication has expired. Though not a part of the HTTP standard, the 419 status code is used as an alternative to 401 to differentiate from unauthorized clients being denied access.

420 - Enhance Your Calm (Twitter)

Returned by version 1 of the Twitter Search and Trends API when the client is being rate limited. Not a part of the HTTP standard.

420 - Method Failure (Spring Framework)

Defined by Spring in the HttpStatus class to be used when a method fails. Not a part of the HTTP standard, this status code is deprecated by Spring.

421 - Misdirected Request (HTTP/2)

Indicates that the request is directed at a server that is unable to produce a response.

422 - Unprocessable Entity (WebDAV; RFC 4918)

Indicates that the request is unable to be followed due to semantic errors.

423 - Locked (WebDAV; RFC 4918)

Indicates that the resource that is being accessed is locked.

424 - Failed Dependency (WebDAV; RFC 4918)

Indicates that the request failed because of the failure of a previous request.

426 - Upgrade Required

Indicates that the client should switch to a different protocol as specified in the Upgrade header field.

428 - Precondition Required (RFC 6585)

Indicates that origin server requires the request to be conditional to prevent the Òlost updateÓ problem.

429 - Too Many Requests (RFC 6585)

Occurs when the user has sent too many requests in a given amount of time. For use with rate limiting.

431 - Request Header Fields Too Large (RFC 6585)

Indicates that the request cannot be processed by the server because a single header field or all headers are collectively too large.

440 - Login Timeout (Microsoft)

Microsoft extension indicating that the session has expired.

444 - No Response (Nginx)

In Nginx logs as a malware deterrent, indicates that the server returned no information and closed the connection.

449 - Retry With (Microsoft)

Microsoft extension indicating that the request should be retried after performing a specific action.

450 - Blocked by Windows Parental Controls (Microsoft)

Microsoft extension indicating that Windows Parental Controls are turned on and blocking access to the page in question.

451 - Redirect (Microsoft)

In Exchange ActiveSync, used when there is a more efficient server or the server cannot access the clientÕs mailbox. Client should re-run the HTTP Autodiscovery protocol to find a better suited server.

451 - Unavailable For Legal Reasons (Internet draft)

Indicates that resource access has been denied for legal reasons such as censorship or government-mandated blocked access. Defined in the Internet draft as "A New HTTP Status Code for Legally-restricted Resources." References the dystopian novel Fahrenheit 451 (1953), in which books are outlawed.

494 - Request Header Too Large (Nginx)

Similar to 431, Nginx internal code earlier in version 0.9.4.

495 - Cert Error (Nginx)

Nginx internal code indicating that SSL client certificate error has occurred

496 - No Cert (Nginx)

Nginx internal code indicating that the client didn't provide certificate.

497 - HTTP to HTTPS (Nginx)

Nginx internal code indicating that plain HTTP requests were sent to HTTPS port.

498 - Token Expired/Invalid (Esri)

Returned by ArcGIS for Server when token is expired or otherwise invalid.

499 - Client Closed Request (Nginx)

In Nginx logs, indicates that the connection has been closed by the client while the server is still processing its request, in which case the server is unable to send a status code back.

499 - Token Required (Esri)

Returned by ArcGIS for Server when a token is required but was not submitted.

4xx Client Error

500 - Internal Server Error

Generic error message for when there is no suitable specific information. Indicates an unexpected condition.

501 - Not Implemented

Indicates that the server does not recognize the method or is unable to fulfill it. Can indicate future availability.

502 - Bad Gateway

Indicates that server, when acting as gateway or proxy, received an invalid response from the upstream server.

503 - Service Unavailable

Indicates that the server is temporarily unavailable, often because of maintenance or overloading.

504 - Gateway Timeout

Indicates that the server, when acting as gateway or proxy, did not receive a timely response from the upstream server.

505 - HTTP Version Not Supported

Occurs when the server does not support the requestÕs HTTP protocol version.

506 - Variant Also Negotiates (RFC 2295)

Indicates that transparent content negotiation for the request is causing a circular reference.

507 - Insufficient Storage (WebDAV; RFC 4918)

Occurs when the server cannot store the representation necessary for completing the request.

508 - Loop Detected (WebDAV; RFC 5842)

Indicates that the server detected an infinite loop while processing the request.

509 - Bandwidth Limit Exceeded (Apache BW/Limited Extension)

Use unknown. Status code not specified by any RFCs.

510 - Not Extended (RFC 2774)

Indicates that the server requires further extensions in order to fulfill the request.

511 - Network Authentication Required (RFC 6585)

Client must authenticate in order to gain network access. Often used by proxies that control network access such as Wi-Fi hotspots.

598 - Network Read Timeout Error (Unknown)

Used by Microsoft HTTP proxies to indicate a network read time-out behind the proxy to a client in front of the proxy. Not specified in any RFCs.

599 - Network connect timeout error (Unknown)

Used by Microsoft HTTP proxies to indicate a network connect time-out behind the proxy to a client in front of the proxy. Not specified in any RFCs.

5xx server error

为了更直观的快速定位问题,有大神将这五类 HTTP 状态码做成一个决策图,可以很方便看到 HTTP 状态由 1xx ~ 5xx 的含义,并提供了常用解决思路。

有了这张图后,是不是当你再遇到 HTTP 报错时,就可以愉快的将锅扔给开发了呢,哈哈!更多 HTTP 排错指南可参考:Troubleshooting HTTP。

如需『 HTTP 故障图解指南 』 高清版,可在公众号对话框回复关键字:「HTTPTroubleshoot」免费获取。

2参考文档

  • https://tinyurl.com/srs4z5vj
  • https://www.loggly.com/blog/http-status-code-diagram/
  • https://documentation.solarwinds.com/en/success_center/loggly/content/admin/troubleshooting-http.htm

本文分享自微信公众号 - 运维之美(Hi-Linux),作者:Mike

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2021-06-28

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 【图解】Kubernetes Deployment 故障排查指南

    如果你不知道从何下手,那么在 Kubernetes 中排查故障可能会是一项艰难的任务。文本以超详细的图解说明了如何对 Kubernetes Deployment...

    CNCF
  • 负载均衡故障排错指南 (3)

    wget和curl是两个常用的,基于命令行的文件传输工具软件。这两个工具很类似,但又有所不同。这两个工具都可以通过FTP、HTTP或HTTPS协议来下载内容,通...

    py3study
  • K8S deployment可视化故障排查指南

    假设您希望部署一个简单的Hello World应用程序,则该应用程序的YAML应该类似于以下内容:

    有点技术
  • Elasticsearch 集群故障排查及修复指南

    Elasticsearch 集群在运行的过程中,由于各种原因,经常会出现健康问题。比较直观的是:kibana监控、head插件监控显示集群非绿色(红色或者黄色)...

    铭毅天下
  • 052.Kubernetes集群管理-故障排错指南

    为了跟踪和发现在Kubernetes集群中运行的容器应用出现的问题,常用如下查错方法:

    木二
  • MySQL内存溢出问题:故障排除指南

    在本文中,我将向您展示如何使用新版本的MySQL(5.7+),以及如何更容易地解决 MySQL内存分配中出现的问题。

    程序你好
  • K8S故障排查指南- but volume paths are still present on disk

    在使用 Kubernetes 时,有时会遇到 Pod 状态一直处理 Terminating。Pod 一直没有正常退出,一般情况会使用命令 kubectl del...

    YP小站
  • 干货!云网络丢包故障定位全景指南

    本期分享一个比较常见的⽹络问题--丢包。例如我们去ping⼀个⽹站,如果能ping通,且⽹站返回信息全⾯,则说明与⽹站服务器的通信是畅通的,如果ping不通,或...

    用户8611941
  • Kubernetes故障排查指南-分析容器退出状态码

    大家在使用 Kubernetes 时,会遇到创建Pod失败,这时会分析什么原因导致创建Pod失败?

    YP小站
  • 技术书单

    《编码:隐匿在计算机软硬件背后的语言》 :零基础入门 《穿越计算机的迷雾》:零基础,但是读起来没有《编码》流畅 《程序是怎么跑起来的》 :除了第6章是讲压缩...

    神秘的寇先森
  • ASM|Automatic Storage Management

    自动存储管理 (ASM) 概念和概述 自动存储管理 (ASM) 安装 自动存储管理 (ASM) 配置 自动存储管理 (ASM) 管理 自动存储管理 (ASM) ...

    JiekeXu之路
  • Linkerd 2.10(Step by Step)—混沌工程之注入故障

    使用 Service Mesh Interface 的 Traffic Split API 很容易将故障注入应用程序。TrafficSplit 允许您将一定比例...

    为少
  • 监控的艺术

    监控的艺术 目录 1. 背景 2. 概述 3. 怎样监控 3.1. 卫星监测 3.2. 逐级诊断 3.3. 模拟人工 3.4. 数据分析 3.5. 监控与开发 ...

    netkiller old
  • REST API设计指导——译自Microsoft REST API Guidelines(一)

    前面我们说了,有章可循,有据可依,有正确的产品流程和规范,我们的工作才不至于产生混乱,团队的工作才能更有成效。我们经常见到,程序开发可能只用了半个月,但是接口的...

    雪雁-心莱科技
  • K8s内功心法之3步排除故障,直呼牛牪犇逼!

    Kubernetes 生态系统充斥着各种工具,例如监控、可观察性、跟踪、日志记录等,但一般很难真正理解故障排除与这些工具有何联系。

    公众号: 云原生生态圈
  • 解决k8s集群环境内存不足导致容器被kill问题

    最近线上环境上出现了一个问题, k8s集群环境Pod中的tomcat容器运行一段时间后直接被killd,但有时一切看起来正常,不能准确判断在什么时机出现被Kil...

    用户5166556
  • Microsoft REST API指南

    经过3个月的碎片时间的翻译和校验,由长沙.NET技术社区翻译的英文原文文档《Microsoft REST API指南 》已经翻译完成,现刊载前十一章如下...

    Edison.Ma
  • 直播回顾 丨TBase多中心多活与高可用方案实践

    腾讯云数据库【国产数据库专题线上技术沙龙】正在火热进行中,4月28日陈爱声的分享已经结束,没来得及参与的小伙伴不用担心,以下就是直播的视频和文字回顾。

    腾讯云数据库 TencentDB
  • 如何加速WordPress网站

    本指南提供了一个测试环境,用于说明优化WordPress的过程。环境有两个组成部分:

    沈唁

扫码关注云+社区

领取腾讯云代金券