nginx 499

1.源码里的定义:
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 /
可以看出是客户端关闭连接,服务端返回的状态码。
网上有说是提交请求过于频繁,服务器返回的。由于个人觉得这个理由过于牵强,就没做测试!

2.模拟
通过curl提交100次请求。在没提交完时,中断请求。服务器端查看日志:

 129.0.1.209 - - [24/May/2018:15:09:49 +0800] "GET /sso/resources/dep/layer-v2.1/skin/layer.css HTTP/1.1" 499 0 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"

3.http 499 与 proxy_ignore_client_abort
proxy_ignore_client_abort 参数默认是关闭的。如果客户端主动关闭请求或者客户端网络断掉,那么 Nginx 会记录 499,同时 request_time 是 「后端已经处理」的时间,而 upstream_response_time 为 “-“ (已验证)。
如果使用了 proxy_ignore_client_abort on ;
那么客户端主动断掉连接之后,Nginx 会等待后端处理完(或者超时),然后 记录 「后端的返回信息」 到日志。所以,如果后端 返回 200, 就记录 200 ;如果后端放回 5XX ,那么就记录 5XX 。
如果超时(默认60s,可以用 proxy_read_timeout 设置),Nginx 会主动断开连接,记录 504。

猜你喜欢

转载自blog.51cto.com/448823/2119933