Nginx 499 Status Code optimization

Source: Internet
Author: User

In the Grafana interface found a lot of 499 status code, on the Internet to understand that 499 of the reasons are generally said that the server processing time is too long, the client actively shut down the connection.

Since the service-side processing time is probably too long, take a look at the upstream_response_time time to see how long the backend program has been processed.

Let's look at what Upstream_response_time and Request_time are, respectively:

    • Request_time: The server receives the first byte from the client request to the service-side application when it finishes sending the response data, including request data time, program response time, output response time
    • Upstream_response_time: Refers to nginx back end such as Php,tomcat and so on to establish a connection to start until the end of processing data closed connection time

As mentioned above, the reason may be the service side processing time is too long, then should upstream_resopnse_time and Request_time time is very long. Look, hit the face, Upstream_response_time no record, Request_time is also very short, that is, Nginx did not forward the request to PHP processing, but directly returned to the 499 status code, so there is no upstream_response _time, and the request_time time is short, even to zero.

So I'm here. 499 is not the server processing time is too long, but there is another reason for him.

It seems that Baidu is not possible, Google find, the reason may be the following:

    1. The client request is too fast, triggering the Nginx protection mechanism and returning the 499 status code directly.
    2. The second scenario is that the client actively shuts down the connection
    3. Certificate Error

Optimization method:

#size limits for 502 499client_max_body_size 50m;    Client_body_buffer_size 256k;    Client_header_timeout 3m;    Client_body_timeout 3m; Client_body_temp_path/dev/shm/client_body_temp; Send_timeout 3m;    Proxy_ignore_client_abort on; # tell Nginx not to actively close the connection proxy_connect_timeout -; proxy_read_timeout  ; Proxy_send_timeout   ;    Proxy_buffer_size 32k; Proxy_buffers464k;    Proxy_busy_buffers_size 128k; Proxy_temp_file_write_size 512k;

Nginx 499 Status Code optimization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.