HTTP 4.5 series status code and nginx status code


Link to he Xiaodong’s blog

http 400+

400 Bad Request
1. Semantic error, the current request cannot be understood by the server. The client should not submit this request repeatedly unless it is modified.
2. Wrong request parameter.

401 Unauthorized
The current request requires user authentication. The response must contain a WWW authenticate header for the requested resource to ask for user information. The client can repeatedly submit a request with appropriate authorization header information. If the current request already contains authorization certificates, the 401 response indicates that the server has rejected those certificates. If the 401 response contains the same authentication query as the previous response, and the browser has tried to verify at least once, the browser should show the user the entity information contained in the response, because the entity information may contain relevant diagnostic information.

402 Payment Required
This response code is reserved for future use. The original purpose of creating this response code is for digital payment system, but it is not used now.

403 Forbidden
The server understood the request, but refused to execute it. Unlike the 401 response, authentication does not help, and the request should not be submitted repeatedly. If this is not a head request, and the server wants to be able to explain why the request cannot be executed, then the reason for rejection should be described in the entity. Of course, the server can also return a 404 response if it doesn’t want the client to get any information.

404 Not Found
The request failed. The desired resource was not found on the server. There is no information to tell users whether the situation is temporary or permanent. If the server knows the situation, it should use 410 status code to inform the old resource that it is permanently unavailable due to some internal configuration mechanism problems, and there is no address to jump to. 404 is widely used when the server doesn’t want to reveal why the request was rejected or no other suitable response is available.

405 Method Not Allowed
The request method specified in the request line cannot be used to request the corresponding resource. The response must return an allow header to indicate the list of request methods that the current resource can accept. In view of the fact that the put and delete methods will write to the resources on the server, most web servers do not support or do not allow the above request methods in the default configuration, and 405 errors will be returned for such requests.

406 Not Acceptable
The content attribute of the requested resource cannot satisfy the condition in the request header, so the response entity cannot be generated.

407 Proxy Authentication Required
Similar to the 401 response, except that the client must authenticate on the proxy server. The proxy server must return a proxy authenticate for identity inquiry. The client can return a proxy authorization header for verification.

408 Request Timeout
The request timed out. The client did not complete a request within the time the server was ready to wait. The client can submit the request again at any time without any changes.

409 Conflict
The request could not be completed due to a conflict with the current state of the requested resource. This code can only be used when the user is considered to be able to resolve the conflict and will submit a new request again. The response should contain enough information for the user to find the source of the conflict.

410 Gone
The requested resource is no longer available on the server and has no known forwarding address. Such a situation should be considered permanent. If possible, the client with link editing function should remove all references to this address after obtaining user permission. If the server does not know or cannot determine whether the condition is permanent, then it should use a 404 status code. Unless otherwise specified, the response is cacheable.

411 Length Required
The server refused to accept the request without defining a content length header. After adding a valid content length header indicating the length of the request message body, the client can submit the request again.

412 Precondition Failed
The server failed to satisfy one or more of the preconditions given in the header field of the request. This status code allows the client to set preconditions in the request meta information (request header field data) when obtaining resources, so as to prevent the request method from being applied to resources other than its desired content.

413 Payload Too Large
The server refuses to process the current request because the size of the entity data submitted by the request exceeds the range that the server is willing or able to process. In this case, the server can close the connection so that the client does not continue to send the request. If this condition is temporary, the server should return a retry after response header to tell the client how long it can try again.

414 URI Too Long
The URI length of the request exceeds the length that the server can interpret, so the server refuses to service the request. This is relatively rare. Common cases include: the form submission method that should have used the post method becomes the get method, resulting in the query string being too long.

415 Unsupported Media Type
For the method of the current request and the requested resource, the entity submitted in the request is not in the format supported by the server, so the request is rejected.

416 Range Not Satisfiable
If the request contains a range request header, and any data range specified in the range does not coincide with the available range of the current resource, and if range request header is not defined in the request, the server should return 416 status code.

417 Expectation Failed
This response code means that the server cannot meet the expected value indicated by the expect request header field.

418 I’m a teapot
The server refused to try “teapot making coffee”. (A spoof hypertext coffee pot transport protocol

421 Misdirected Request
The request is for a server that cannot generate a response. This can be sent by a server that is not configured to respond to a combination of schemes and permissions contained in the request URI.

422 Unprocessable Entity (WebDAV)
The request is well formed but cannot be followed due to semantic errors.

423 Locked (WebDAV)
The resource being accessed is locked.

424 Failed Dependency (WebDAV)
This request failed because the previous request failed.

425 Too Early
The server is not willing to take the risk to process requests that may be replayed.

426 Upgrade Required
The server refuses to execute the request using the current protocol, but may be willing to do so after the client has upgraded to another protocol. The server sends the upgrade header in the 426 response to indicate the required protocol.

428 Precondition Required
The original server requires that the request be conditional. The purpose of this paper is to prevent the “lost update” problem, that is, the client obtains the resource status, modifies the status and returns it to the server, while the third party modifies the status on the server, resulting in conflicts.

429 Too Many Requests
The user sent too many requests in a given time (“limit request rate”). (it is often used for SMS verification code, e-mail verification code, password retrieval, etc.)

431 Request Header Fields Too Large
The server is reluctant to process the request because its request header fields are too large. The request can be submitted again after reducing the size of the request header field.

451 Unavailable For Legal Reasons
Users request illegal resources, such as web pages censored by the government. (the e-commerce platform restricts the frequent use of mobile phone black numbers)

http 500+

500 Internal Server Error
The server encountered a situation that it didn’t know how to handle.

501 Not Implemented
This request method is not supported by the server and cannot be processed. Only get and head are required to be supported by the server, and they will not return this error code.

502 Bad Gateway
This error response indicates that the server, as a gateway, needs to get a response to process the request, but gets an error response.

503 Service Unavailable
The server is not ready to process the request. A common cause is server downtime due to maintenance or overloading. Note that with this response, a user-friendly page explaining the problem should be sent. This response should be used for temporary conditions and retry after: if possible, the HTTP header should contain the estimated time before resuming the service. Webmasters must also pay attention to the cache related headers sent with this response, because these temporary conditional responses should not normally be cached.

504 Gateway Timeout
This error code is returned when the server, as a gateway, cannot receive a response in time.

505 HTTP Version Not Supported
The server does not support the HTTP protocol version used in the request.

506 Variant Also Negotiates
The server has an internal configuration error: transparent content negotiation of the request results in a circular reference.

507 Insufficient Storage
The server has an internal configuration error: the selected variant resource is configured to participate in the transparent content negotiation itself, so it is not an appropriate endpoint in the negotiation process.

508 Loop Detected (WebDAV)
The server detected an infinite loop while processing the request.

510 Not Extended
The client needs to extend the request further before the server can implement it. The server will reply to all the information that the client needs to make the extension request.

511 Network Authentication Required
The 511 status code indicates that the client needs to authenticate in order to gain network access.

State code defined by nginx

The unofficial status code is just the source code location defined by nginx to facilitate debugging

ngx_string(ngx_http_error_494_page), /* 494, request header too large */
ngx_string(ngx_http_error_495_page), /* 495, https certificate error */
ngx_string(ngx_http_error_496_page), /* 496, https no certificate */
ngx_string(ngx_http_error_497_page), /* 497, http to https */
ngx_string(ngx_http_error_404_page), /* 498, canceled */
ngx_null_string,                     /* 499, client has closed connection */

494 request header too large (nginx)
Nginx built-in code is similar to 431.

495 certificate error (nginx)
Nginx built-in code, when using SSL client certificate, the error will appear, in order to distinguish it from 4xx in the log error and the redirection of an error page.

496 no certificate (nginx)
Nginx built-in code, when the client can not provide a certificate in the log to distinguish 4xx and an error page redirection.

497 HTTP to HTTPS (nginx)
Nginx built-in code is used to send the original HTTP request to the HTTPS port to distinguish the redirection of 4xx in the log and an error page.

498 cancelled
I don’t know the meaning

499 client shutdown request (nginx)
It is used in nginx logs to indicate that a connection has been closed by the client. When the server is still processing its request, yes, the server cannot return the status code.

499 status code can be used to create an interface through curl, then set timeout = 1s, at the same time, the back-end interface sleep (2); and then return to reproduce the status code.

Reference link:

  1. Definition of IANA status code
  2. Wikipedia HTTP status code

By the way, I’d like to recommend a new user preferential Alibaba cloud server