您的位置:首页 > 理论基础 > 计算机网络

Nginx的HTTP 499状态码及问题处理

2020-07-24 15:16 567 查看

1、遇到的问题

127.0.0.1 - - [24/Jul/2020:09:24:20 +0800] "POST /admin/upload/o_upload HTTP/1.1" 499 0 "http://localhost:8020/jeecms/index.html" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "-"

2、处理方法
  499错误是什么?让我们看看NGINX的源码中的定义:
  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 */
  
 可以看到,499对应的是 “client has closed connection”。这很有可能是因为服务器端处理的时间过长,客户端“不耐烦”了。
 测试nginx发现如果两次提交post过快就会出现499的情况,看来是nginx认为是不安全的连接,主动拒绝了客户端的连接.
在google上搜索到一英文论坛上有关于此错误的解决方法:
proxy_ignore_client_abort on;
Don’t know if this is safe.
就是说要配置参数 proxy_ignore_client_abort on;
表示代理服务端不要主要主动关闭客户端连接。
以此配置重启nginx,问题果然得到解决。只是安全方面稍有欠缺,但比总是出现找不到服务器好多了。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: