首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >HTTP 故障图解指南

HTTP 故障图解指南

作者头像
iMike
发布2021-07-01 09:49:38
1.6K0
发布2021-07-01 09:49:38
举报
文章被收录于专栏:运维之美运维之美运维之美

网页打开某个网站,可以看到正常的内容,这个 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
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-06-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 奇妙的Linux世界 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1HTTP 状态代码决策图
  • 2参考文档
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档