HTTP 499 Status Code nginx 499 error Resolution _nginx

Source: Internet
Author: User
Tags nginx server

There are 499 errors in the HTTP status code in the log record there are a number of cases, I encountered a situation is nginx to a never open back-end, so, the log status record is 499, the number of bytes sent is 0.

Always have users reflect the site system good when bad, because the product on the line has not been modified for a long time, so the front-end program can be basically ruled out the problem, so the call is to get the interface instability, asked the relevant personnel, said no problem, in order to get the exact evidence, So I asked the relevant people to the Nginx server log file (awstats log), analysis found that many errors in the log error code 499 error, accounting for the entire log file of 1%, and it accounted for only about 70% of all errors (see the following figure), then all the errors add up to more than 1%, This volume is still particularly large.

What is the 499 error? Let's look at the definition in Nginx's source code:

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 * *

As you can see, 499 corresponds to "client has closed connection". This is most likely because the server-side processing time is too long, the client "impatient".

Causes and solutions of Nginx 499 errors

Open Nginx Access.log found in the last submission is the HTTP1.1 499 0-Such a mistake, in Baidu search Nginx 499 errors, the result is that the client actively disconnected the connection.

But after my test this is obviously not a client issue, because this problem does not exist with the port +ip direct access to the backend server, the test nginx found that if the two submit post is too fast, it appears that Nginx is considered an unsafe connection and actively rejects the client connection.

But search-related issues have been unable to find a solution, and finally Google found in an English forum on the resolution of this error:

Proxy_ignore_client_abort on;
Don ' t know if this is safe.

This means that you want to configure the parameter proxy_ignore_client_abort on;

Indicates that the proxy server does not primarily actively shut down client connections.

With this configuration restart Nginx, the problem is solved. It's just a little bit less secure, but it's much better than always appearing to be unable to find a server.

Another reason is that I later test found that the client is actually shutting down the connection, or that the connection timed out, no matter how many times you set the timeout time is not the original PHP process is not enough to improve the number of PHP process to solve the default test environment to open 5 sub processes.

The above is a small set to introduce the HTTP 499 status code nginx 499 wrong solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.