本文主要来聊一下nginx的access log当中出现的499问题。

问题描述

499 CLIENT CLOSED REQUEST

A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request.

原因

服务器返回http头之前,客户端就提前关闭了http连接,常见于后台接口处理时间比较长,而前端请求又自带有超时时间。

复现

请求实例

<!DOCTYPE html>
<html>
<head>
<script src="http://www.w3school.com.cn/jquery/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){$("button").click(function(){$.ajax({url : '/demo/test',timeout : 10000,type : 'get',dataType : 'json',success : function(data){alert('success');}});});
});
</script>
</head>
<body><button>ajax带超时时间请求</button></body>
</html>复制代码

后台接口

    @GetMapping("/test")public String test(HttpServletResponse response) throws InterruptedException {Thread.sleep(100*1000);return "hello";}复制代码

nginx

        location /demo/ {access_log  /usr/local/var/log/nginx/host.access.log  main;proxy_pass http://localhost:8080/demo/ ;}复制代码

关于log format如下

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';复制代码

log实例

127.0.0.1 - - [04/Nov/2017:01:11:29 +0800] "GET /demo/test HTTP/1.1" 499 0 "http://localhost:8888/demo.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" "-"
127.0.0.1 - - [04/Nov/2017:01:11:42 +0800] "GET /demo/test HTTP/1.1" 499 0 "http://localhost:8888/demo.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" "-"
127.0.0.1 - - [04/Nov/2017:01:11:58 +0800] "GET /demo/test HTTP/1.1" 499 0 "http://localhost:8888/demo.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" "-"复制代码

doc

  • 499 CLIENT CLOSED REQUEST
  • 服务器排障 之 nginx 499 错误的解决

聊聊nginx报错499问题相关推荐

  1. nginx 报错 99: Cannot assign requested address

    为什么80%的码农都做不了架构师?>>>    nginx 报错 99: Cannot assign requested address net.ipv4.ip_local_port ...

  2. Nginx报错:nginx: [emerg] CreateFile() nginx.conf“ failed (3: The system cannot find the path specified

    windows下启动nginx报错: nginx: [emerg] CreateFile() "D:\桌面\nginx-1.12.0/conf/nginx.conf" failed ...

  3. [nginx报错]---unknown directive chunkin in /XXXXX/XXXXXX:XX的几种解决方式

    问题: nginx报错:unknown directive "chunkin" in /XXXXX/XXXXXX:XX 解决: 当出现unknown directive,一般有个反 ...

  4. nginx 报错 upstream timed out (110: Connection timed out)解决方案

    nginx 报错 upstream timed out (110: Connection timed out)解决方案 参考文章: (1)nginx 报错 upstream timed out (11 ...

  5. [问题已处理]-[nginx]-nginx 报错 could not build server_names_hash

    nginx 报错 could not build server_names_hash 这边添加了一个比较长的域名  测试nginx配置就报如下错误 在http{}下添加 server_names_ha ...

  6. phpstudy环境下laravel项目,Nginx报错CreateFile failed

    phpstudy nginx环境,nginx报错日志如下: 2020/04/13 15:40:33 [error] 7844#14252: *7 CreateFile() "D:/phpst ...

  7. Nginx报错:Sorry,thepageyouarelookingforiscurrentlyunavailable.Pleasetryagainlater._马立杰_新浪博客...

    Nginx报错:Sorry,thepageyouarelookingforiscurrentlyunavailable.Pleasetryagainlater. 原文链接:http://www.orc ...

  8. nginx报错:nginx: [error] OpenEvent(“Global\ngx_reload_89728“) failed

    nginx报错:nginx: [error] OpenEvent("Global\ngx_reload_89728") failed (2: The system cannot f ...

  9. Nginx报错:upstream timed out (110: Connection timed out)和client intended to send too large body【转】...

    nginx日志报错 2018/01/26 16:36:49 [error] 23327#0: *54953 upstream timed out (110: Connection timed out) ...

最新文章

  1. as一种模拟输入效果
  2. 被“嫌弃”的AI药物设计
  3. 笔记-项目整体管理-指导与管理项目工作的输出
  4. mysql执行shell命令_关键Docker命令:使用Docker必须掌握的公认宝典
  5. 计算机控制课程设计体会,计算机控制技术课程设计报告
  6. 详解CockroachDB事务处理系统
  7. 使用Java的RESTful Web服务
  8. 2017双11技术揭秘—千亿级流量来袭,如何用硬件加速技术为CPU减负?
  9. 鸿蒙系统起飞!Flutter 完全适配指南
  10. 试用版:springboot集成pageoffice实现word在线预览可编辑
  11. spring的核心模块
  12. 嵌入式单片机基础篇(十一)之电容触摸按键
  13. 二倍图css,二倍图/三倍图的分辨率问题
  14. 【源码+图片素材】1小时做出Java坦克大战小游戏_Java初级项目_Java练手项目_Java项目实战_Java游戏开发实战教学_Java课程设计_课设
  15. AcWing 1191. 家谱树 题解(拓扑排序)
  16. Android 11.0 12.0系统默认授予读写权限给第三方app
  17. Neos Flow ActionController 返回JSON
  18. setLenient(true/false)
  19. 小米盒子1s真心不让我爽
  20. 搜狗站群之搜狗泛目录实现搜狗大量泛收录

热门文章

  1. POJ1276Cash Machine
  2. 30个精美的模板,贺卡,图形圣诞素材
  3. C# 3.0/3.5语法新特性示例汇总[转]
  4. 使用ADO.NET 的最佳实践(zz)
  5. Solr占用CPU持续过高原因查询
  6. PHP APC安装与使用
  7. linux下poll和epoll内核源代码剖析
  8. 织梦内容管理系统修改
  9. Asp.Net下通过切换CSS换皮肤
  10. C#WinForm制作异形窗体/控件