nginx 转发后端请求,最大返回值不能超过10k.

最终答案

  • fdm有个计划任务,当把那个关掉后正常了,不知道为什么他会默认限制80端口一次10k的大小,但是问题确实出现在他身上
  • 这个破问题,浪费了5天...................

以下的全部归档,可以作为排查的思路

  • 问题明朗了,80端口好像被限制了,一次只能传低于10k大小,高于的就像被拦截一样.因为我直接把后端地址监听了80端口,也是不行,跟nginx,docker没半毛钱关系,
  • 现在就是求一个精通windows的大佬给给我解答了,到底是怎么回事80莫名其妙被限制

最新猜测

  • 应该是跟响应头相关的配置(或者是其他能改变传送方式的)
  • 因为一步一步从nest到原生Node,并且减少了请求头后,能请求的数据也变多,那么说明应该是响应头和响应体共用了一个大小,应该是能把这个大小调大从而接收数据的

推翻所有猜测(包括上面的和下面的)

  • 使用环境win10,本机nginx,本机静态文件,直接访问静态文件,也是快超过10k时,立马处于长时间请求状态,然后失败.所以问题不在转发,不在代理上,就是在于nginx 拿到数据后,为何超过10k的数据,就不返回了,是我的操作系统问题,还是少了什么配置?这个问题这么难吗

目前已经在docker上,本机(win10)上试过,版本1.17.3,1.14.2,1.10.3,均不正常,考虑到我是一个初学者,肯定不能有个这么大的bug,nginx没解决,所以应该是配置问题吧

情景还原

  • 直接从后端(nestjs直接来的demo)请求数据,多大的都ok,使用postman
  • 走nginx的转发,最大不超过10k,超过就会一直处于请求状态,然后过一会失败
这里的最大大小我测试是文本长度在9700左右,docker中是9697,本机是9729,
  • 当超过后,并没有nginx的报错,反而是一个成功的日志,和普通的成功一模一样

相关代码

nginx配置

worker_processes 1;

events {
    worker_connections 1024;
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    upstream nodejs {
        server 127.0.0.1:3000;
        keepalive 64;
    }
    server {
        listen 80;
        server_name 0.0.0.0;
        root /;
        location ~ ^/(api) {
            proxy_pass http://nodejs;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
        }
    }
}

## access.log日志
  • 第一个长度是9729的,postman/chrome上都能看到数据
  • 第二个长度是9730的,postman/chrome就会一直请求,直至失败
127.0.0.1 - - [20/Aug/2019:23:26:01 +0800] "GET /api/carnews HTTP/1.1" 200 9729 "-" "PostmanRuntime/7.13.0"
127.0.0.1 - - [20/Aug/2019:23:26:12 +0800] "GET /api/carnews HTTP/1.1" 200 9730 "-" "PostmanRuntime/7.13.0"

后端代码

  • 为了防止环境对问题的干扰,已经从docker内nest->主机nest->原生代码,另外原生代码又进一步...支持了9796数据.我感觉不是原生代码支持多了,而是好像应该是返回的响应头变少了,从而能拿到数据变多了
var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    let str = ''
    for (let i = 0; i < 9796; i++) {
        str = `${str}0`
    }
    console.log(str.length)
    res.end(str);
}).listen(3000, '127.0.0.1');

debug日志

  • debug抓取9729(能成功返回),9730(日志成功,返回不了的数据),根据我自己的分析,貌似两个日志没啥不同.........
#9729
2019/08/21 08:18:46 [debug] 3540#7264: *1 http cl:-1 max:1048576
2019/08/21 08:18:46 [debug] 3540#7264: *1 rewrite phase: 3
2019/08/21 08:18:46 [debug] 3540#7264: *1 post rewrite phase: 4
2019/08/21 08:18:46 [debug] 3540#7264: *1 generic phase: 5
2019/08/21 08:18:46 [debug] 3540#7264: *1 generic phase: 6
2019/08/21 08:18:46 [debug] 3540#7264: *1 generic phase: 7
2019/08/21 08:18:46 [debug] 3540#7264: *1 access phase: 8
2019/08/21 08:18:46 [debug] 3540#7264: *1 access phase: 9
2019/08/21 08:18:46 [debug] 3540#7264: *1 access phase: 10
2019/08/21 08:18:46 [debug] 3540#7264: *1 post access phase: 11
2019/08/21 08:18:46 [debug] 3540#7264: *1 generic phase: 12
2019/08/21 08:18:46 [debug] 3540#7264: *1 generic phase: 13
2019/08/21 08:18:46 [debug] 3540#7264: *1 http init upstream, client timer: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: "X-Real-IP"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script var: "127.0.0.1"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: "X-Forwarded-For"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script var: "127.0.0.1"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: "Host"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script var: "127.0.0.1"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: "Connection"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: "close"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: ""
2019/08/21 08:18:46 [debug] 3540#7264: *1 http script copy: ""
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "User-Agent: PostmanRuntime/7.13.0"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Accept: */*"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Cache-Control: no-cache"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Postman-Token: 9ebcc43f-4cd8-4b43-8d6c-94abc434a597"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "accept-encoding: gzip, deflate"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header:
"GET /api/carnews HTTP/1.0
X-Real-IP: 127.0.0.1
X-Forwarded-For: 127.0.0.1
Host: 127.0.0.1
Connection: close
User-Agent: PostmanRuntime/7.13.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 9ebcc43f-4cd8-4b43-8d6c-94abc434a597
accept-encoding: gzip, deflate

"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http cleanup add: 02CD8F44
2019/08/21 08:18:46 [debug] 3540#7264: *1 init keepalive peer
2019/08/21 08:18:46 [debug] 3540#7264: *1 get keepalive peer
2019/08/21 08:18:46 [debug] 3540#7264: *1 get rr peer, try: 1
2019/08/21 08:18:46 [debug] 3540#7264: *1 stream socket 600
2019/08/21 08:18:46 [debug] 3540#7264: *1 connect to 127.0.0.1:3000, fd:600 #2
2019/08/21 08:18:46 [debug] 3540#7264: *1 select add event fd:600 ev:0
2019/08/21 08:18:46 [debug] 3540#7264: *1 select add event fd:600 ev:1
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream connect: -2
2019/08/21 08:18:46 [debug] 3540#7264: *1 malloc: 0297DE58:128
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer add: 600: 60000:2978690325
2019/08/21 08:18:46 [debug] 3540#7264: *1 http finalize request: -4, "/api/carnews?" a:1, c:2
2019/08/21 08:18:46 [debug] 3540#7264: *1 http request count:2 blk:0
2019/08/21 08:18:46 [debug] 3540#7264: *1 post event 02D25648
2019/08/21 08:18:46 [debug] 3540#7264: *1 delete posted event 02D25648
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream request: "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream send request handler
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream send request
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream send request body
2019/08/21 08:18:46 [debug] 3540#7264: *1 chain writer buf fl:1 s:273
2019/08/21 08:18:46 [debug] 3540#7264: *1 chain writer in: 02CD8F80
2019/08/21 08:18:46 [debug] 3540#7264: *1 WSASend: fd:600, s:273
2019/08/21 08:18:46 [debug] 3540#7264: *1 chain writer out: 00000000
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer del: 600: 2978690325
2019/08/21 08:18:46 [debug] 3540#7264: *1 select del event fd:600 ev:1
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer add: 600: 60000:2978690326
2019/08/21 08:18:46 [debug] 3540#7264: *1 post event 02D11640
2019/08/21 08:18:46 [debug] 3540#7264: *1 delete posted event 02D11640
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream request: "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream process header
2019/08/21 08:18:46 [debug] 3540#7264: *1 malloc: 03145020:5242880
2019/08/21 08:18:46 [debug] 3540#7264: *1 WSARecv: fd:600 rc:0 9933 of 5242880
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy status 200 "200 OK"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "X-Powered-By: Express"
2019/08/21 08:18:46 [debug] 3540#7264: *1 malloc: 02CD90C0:4096
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Content-Type: text/html; charset=utf-8"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Content-Length: 9729"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "ETag: W/"2601-azUGLq7ozrCoIXLEEuxlB9L/iQA""
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Date: Wed, 21 Aug 2019 00:18:46 GMT"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header: "Connection: close"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy header done
2019/08/21 08:18:46 [debug] 3540#7264: *1 HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Wed, 21 Aug 2019 00:18:46 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 9729
Connection: keep-alive
X-Powered-By: Express
ETag: W/"2601-azUGLq7ozrCoIXLEEuxlB9L/iQA"

2019/08/21 08:18:46 [debug] 3540#7264: *1 write new buf t:1 f:0 02CD91CC, pos 02CD91CC, size: 231 file: 0, size: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http write filter: l:0 f:0 s:231
2019/08/21 08:18:46 [debug] 3540#7264: *1 http cacheable: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http proxy filter init s:200 h:0 c:0 l:9729
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream process upstream
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe read upstream: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe preread: 9729
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe buf free s:0 t:1 f:0 03145020, pos 031450EC, size: 9729 file: 0, size: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe length: 9729
2019/08/21 08:18:46 [debug] 3540#7264: *1 input buf #0
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe write downstream: 1
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe write downstream flush in
2019/08/21 08:18:46 [debug] 3540#7264: *1 http output filter "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http copy filter: "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http postpone filter "/api/carnews?" 02CD90B0
2019/08/21 08:18:46 [debug] 3540#7264: *1 write old buf t:1 f:0 02CD91CC, pos 02CD91CC, size: 231 file: 0, size: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 write new buf t:1 f:0 03145020, pos 031450EC, size: 9729 file: 0, size: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http write filter: l:0 f:0 s:9960
2019/08/21 08:18:46 [debug] 3540#7264: *1 http write filter limit 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 WSASend: fd:596, s:9960
2019/08/21 08:18:46 [debug] 3540#7264: *1 http write filter 00000000
2019/08/21 08:18:46 [debug] 3540#7264: *1 http copy filter: 0 "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 pipe write downstream done
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer: 600, old: 2978690326, new: 2978690340
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream exit: 00000000
2019/08/21 08:18:46 [debug] 3540#7264: *1 finalize http upstream request: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 finalize http proxy request
2019/08/21 08:18:46 [debug] 3540#7264: *1 free keepalive peer
2019/08/21 08:18:46 [debug] 3540#7264: *1 free rr peer 1 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 close http upstream connection: 600
2019/08/21 08:18:46 [debug] 3540#7264: *1 free: 0297DE58, unused: 88
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer del: 600: 2978690326
2019/08/21 08:18:46 [debug] 3540#7264: *1 select del event fd:600 ev:0
2019/08/21 08:18:46 [debug] 3540#7264: *1 reusable connection: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http upstream temp fd: -1
2019/08/21 08:18:46 [debug] 3540#7264: *1 http output filter "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http copy filter: "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http postpone filter "/api/carnews?" 02EBF6A0
2019/08/21 08:18:46 [debug] 3540#7264: *1 write new buf t:0 f:0 00000000, pos 00000000, size: 0 file: 0, size: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http write filter: l:1 f:0 s:0
2019/08/21 08:18:46 [debug] 3540#7264: *1 http copy filter: 0 "/api/carnews?"
2019/08/21 08:18:46 [debug] 3540#7264: *1 http finalize request: 0, "/api/carnews?" a:1, c:1
2019/08/21 08:18:46 [debug] 3540#7264: *1 set http keepalive handler
2019/08/21 08:18:46 [debug] 3540#7264: *1 http close request
2019/08/21 08:18:46 [debug] 3540#7264: *1 http log handler
2019/08/21 08:18:46 [debug] 3540#7264: *1 free: 03145020
2019/08/21 08:18:46 [debug] 3540#7264: *1 free: 02CD80B8, unused: 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 free: 02CD90C0, unused: 3151
2019/08/21 08:18:46 [debug] 3540#7264: *1 free: 02CE10D0
2019/08/21 08:18:46 [debug] 3540#7264: *1 hc free: 00000000
2019/08/21 08:18:46 [debug] 3540#7264: *1 hc busy: 00000000 0
2019/08/21 08:18:46 [debug] 3540#7264: *1 tcp_nodelay
2019/08/21 08:18:46 [debug] 3540#7264: *1 reusable connection: 1
2019/08/21 08:18:46 [debug] 3540#7264: *1 event timer add: 596: 65000:2978695340
2019/08/21 08:19:51 [debug] 3540#7264: *1 event timer del: 596: 2978695340
2019/08/21 08:19:51 [debug] 3540#7264: *1 http keepalive handler
2019/08/21 08:19:51 [debug] 3540#7264: *1 close http connection: 596
2019/08/21 08:19:51 [debug] 3540#7264: *1 select del event fd:596 ev:0
2019/08/21 08:19:51 [debug] 3540#7264: *1 reusable connection: 0
2019/08/21 08:19:51 [debug] 3540#7264: *1 free: 00000000
2019/08/21 08:19:51 [debug] 3540#7264: *1 free: 0297DD50, unused: 28
#9730
2019/08/21 08:11:08 [debug] 15264#18204: *1 http cl:-1 max:1048576
2019/08/21 08:11:08 [debug] 15264#18204: *1 rewrite phase: 3
2019/08/21 08:11:08 [debug] 15264#18204: *1 post rewrite phase: 4
2019/08/21 08:11:08 [debug] 15264#18204: *1 generic phase: 5
2019/08/21 08:11:08 [debug] 15264#18204: *1 generic phase: 6
2019/08/21 08:11:08 [debug] 15264#18204: *1 generic phase: 7
2019/08/21 08:11:08 [debug] 15264#18204: *1 access phase: 8
2019/08/21 08:11:08 [debug] 15264#18204: *1 access phase: 9
2019/08/21 08:11:08 [debug] 15264#18204: *1 access phase: 10
2019/08/21 08:11:08 [debug] 15264#18204: *1 post access phase: 11
2019/08/21 08:11:08 [debug] 15264#18204: *1 generic phase: 12
2019/08/21 08:11:08 [debug] 15264#18204: *1 generic phase: 13
2019/08/21 08:11:08 [debug] 15264#18204: *1 http init upstream, client timer: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: "X-Real-IP"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script var: "127.0.0.1"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: "X-Forwarded-For"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script var: "127.0.0.1"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: "Host"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script var: "127.0.0.1"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: "Connection"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: "close"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: ""
2019/08/21 08:11:08 [debug] 15264#18204: *1 http script copy: ""
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "User-Agent: PostmanRuntime/7.13.0"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Accept: */*"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Cache-Control: no-cache"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Postman-Token: be0ffd88-6dbb-4eab-b3bb-dc43907a3351"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "accept-encoding: gzip, deflate"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header:
"GET /api/carnews HTTP/1.0
X-Real-IP: 127.0.0.1
X-Forwarded-For: 127.0.0.1
Host: 127.0.0.1
Connection: close
User-Agent: PostmanRuntime/7.13.0
Accept: */*
Cache-Control: no-cache
Postman-Token: be0ffd88-6dbb-4eab-b3bb-dc43907a3351
accept-encoding: gzip, deflate

"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http cleanup add: 00648F44
2019/08/21 08:11:08 [debug] 15264#18204: *1 init keepalive peer
2019/08/21 08:11:08 [debug] 15264#18204: *1 get keepalive peer
2019/08/21 08:11:08 [debug] 15264#18204: *1 get rr peer, try: 1
2019/08/21 08:11:08 [debug] 15264#18204: *1 stream socket 592
2019/08/21 08:11:08 [debug] 15264#18204: *1 connect to 127.0.0.1:3000, fd:592 #2
2019/08/21 08:11:08 [debug] 15264#18204: *1 select add event fd:592 ev:0
2019/08/21 08:11:08 [debug] 15264#18204: *1 select add event fd:592 ev:1
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream connect: -2
2019/08/21 08:11:08 [debug] 15264#18204: *1 malloc: 0097DE58:128
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer add: 592: 60000:2978232939
2019/08/21 08:11:08 [debug] 15264#18204: *1 http finalize request: -4, "/api/carnews?" a:1, c:2
2019/08/21 08:11:08 [debug] 15264#18204: *1 http request count:2 blk:0
2019/08/21 08:11:08 [debug] 15264#18204: *1 post event 00695648
2019/08/21 08:11:08 [debug] 15264#18204: *1 delete posted event 00695648
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream request: "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream send request handler
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream send request
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream send request body
2019/08/21 08:11:08 [debug] 15264#18204: *1 chain writer buf fl:1 s:273
2019/08/21 08:11:08 [debug] 15264#18204: *1 chain writer in: 00648F80
2019/08/21 08:11:08 [debug] 15264#18204: *1 WSASend: fd:592, s:273
2019/08/21 08:11:08 [debug] 15264#18204: *1 chain writer out: 00000000
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer del: 592: 2978232939
2019/08/21 08:11:08 [debug] 15264#18204: *1 select del event fd:592 ev:1
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer add: 592: 60000:2978232941
2019/08/21 08:11:08 [debug] 15264#18204: *1 post event 00681640
2019/08/21 08:11:08 [debug] 15264#18204: *1 delete posted event 00681640
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream request: "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream process header
2019/08/21 08:11:08 [debug] 15264#18204: *1 malloc: 03292020:5242880
2019/08/21 08:11:08 [debug] 15264#18204: *1 WSARecv: fd:592 rc:0 9934 of 5242880
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy status 200 "200 OK"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "X-Powered-By: Express"
2019/08/21 08:11:08 [debug] 15264#18204: *1 malloc: 006490C0:4096
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Content-Type: text/html; charset=utf-8"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Content-Length: 9730"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "ETag: W/"2602-6Rj2eEk783VCSEUpwZPPqxFmOb4""
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Date: Wed, 21 Aug 2019 00:11:08 GMT"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header: "Connection: close"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy header done
2019/08/21 08:11:08 [debug] 15264#18204: *1 HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Wed, 21 Aug 2019 00:11:08 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 9730
Connection: keep-alive
X-Powered-By: Express
ETag: W/"2602-6Rj2eEk783VCSEUpwZPPqxFmOb4"

2019/08/21 08:11:08 [debug] 15264#18204: *1 write new buf t:1 f:0 006491CC, pos 006491CC, size: 231 file: 0, size: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http write filter: l:0 f:0 s:231
2019/08/21 08:11:08 [debug] 15264#18204: *1 http cacheable: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http proxy filter init s:200 h:0 c:0 l:9730
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream process upstream
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe read upstream: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe preread: 9730
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe buf free s:0 t:1 f:0 03292020, pos 032920EC, size: 9730 file: 0, size: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe length: 9730
2019/08/21 08:11:08 [debug] 15264#18204: *1 input buf #0
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe write downstream: 1
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe write downstream flush in
2019/08/21 08:11:08 [debug] 15264#18204: *1 http output filter "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http copy filter: "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http postpone filter "/api/carnews?" 006490B0
2019/08/21 08:11:08 [debug] 15264#18204: *1 write old buf t:1 f:0 006491CC, pos 006491CC, size: 231 file: 0, size: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 write new buf t:1 f:0 03292020, pos 032920EC, size: 9730 file: 0, size: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http write filter: l:0 f:0 s:9961
2019/08/21 08:11:08 [debug] 15264#18204: *1 http write filter limit 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 WSASend: fd:588, s:9961
2019/08/21 08:11:08 [debug] 15264#18204: *1 http write filter 00000000
2019/08/21 08:11:08 [debug] 15264#18204: *1 http copy filter: 0 "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 pipe write downstream done
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer: 592, old: 2978232941, new: 2978232981
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream exit: 00000000
2019/08/21 08:11:08 [debug] 15264#18204: *1 finalize http upstream request: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 finalize http proxy request
2019/08/21 08:11:08 [debug] 15264#18204: *1 free keepalive peer
2019/08/21 08:11:08 [debug] 15264#18204: *1 free rr peer 1 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 close http upstream connection: 592
2019/08/21 08:11:08 [debug] 15264#18204: *1 free: 0097DE58, unused: 88
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer del: 592: 2978232941
2019/08/21 08:11:08 [debug] 15264#18204: *1 select del event fd:592 ev:0
2019/08/21 08:11:08 [debug] 15264#18204: *1 reusable connection: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http upstream temp fd: -1
2019/08/21 08:11:08 [debug] 15264#18204: *1 http output filter "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http copy filter: "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http postpone filter "/api/carnews?" 02ECFB64
2019/08/21 08:11:08 [debug] 15264#18204: *1 write new buf t:0 f:0 00000000, pos 00000000, size: 0 file: 0, size: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http write filter: l:1 f:0 s:0
2019/08/21 08:11:08 [debug] 15264#18204: *1 http copy filter: 0 "/api/carnews?"
2019/08/21 08:11:08 [debug] 15264#18204: *1 http finalize request: 0, "/api/carnews?" a:1, c:1
2019/08/21 08:11:08 [debug] 15264#18204: *1 set http keepalive handler
2019/08/21 08:11:08 [debug] 15264#18204: *1 http close request
2019/08/21 08:11:08 [debug] 15264#18204: *1 http log handler
2019/08/21 08:11:08 [debug] 15264#18204: *1 free: 03292020
2019/08/21 08:11:08 [debug] 15264#18204: *1 free: 006480B8, unused: 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 free: 006490C0, unused: 3151
2019/08/21 08:11:08 [debug] 15264#18204: *1 free: 006510D0
2019/08/21 08:11:08 [debug] 15264#18204: *1 hc free: 00000000
2019/08/21 08:11:08 [debug] 15264#18204: *1 hc busy: 00000000 0
2019/08/21 08:11:08 [debug] 15264#18204: *1 tcp_nodelay
2019/08/21 08:11:08 [debug] 15264#18204: *1 reusable connection: 1
2019/08/21 08:11:08 [debug] 15264#18204: *1 event timer add: 588: 65000:2978237981
2019/08/21 08:11:27 [debug] 15264#18204: *1 post event 006815F0
2019/08/21 08:11:27 [debug] 15264#18204: *1 delete posted event 006815F0
2019/08/21 08:11:27 [debug] 15264#18204: *1 http keepalive handler
2019/08/21 08:11:27 [debug] 15264#18204: *1 malloc: 006510D0:1024
2019/08/21 08:11:27 [debug] 15264#18204: *1 WSARecv: fd:588 rc:-1 0 of 1024
2019/08/21 08:11:27 [info] 15264#18204: *1 client 127.0.0.1 closed keepalive connection (10054: An existing connection was forcibly closed by the remote host)
2019/08/21 08:11:27 [debug] 15264#18204: *1 close http connection: 588
2019/08/21 08:11:27 [debug] 15264#18204: *1 event timer del: 588: 2978237981
2019/08/21 08:11:27 [debug] 15264#18204: *1 select del event fd:588 ev:0
2019/08/21 08:11:27 [debug] 15264#18204: *1 reusable connection: 0
2019/08/21 08:11:27 [debug] 15264#18204: *1 free: 006510D0
2019/08/21 08:11:27 [debug] 15264#18204: *1 free: 0097DD50, unused: 28

疑问

  • 不知道有没有人这么问(之前发stackoverflow有老外问),你直接请求后端不就ok了,干嘛非要走nginx了.......这个问题我真的没法回答...因为不属于我要问的问题
外国也有不太正常的人,问我为啥不直接连后端,我说为了学习docker,结果他又反问,你这个问题跟docker没关系..........我本来也没说跟docker有关系,只不过在docker运行中发现了这个问题,所以一步一步分离问题,寻求解答.......看来老外也有不靠谱的,正经问题不回答,净想没用的
  • 按照常理,第二个转发数据没显示成功,应该是在error.log中的,但是看了多遍,发现error.log里没任何数据,这就造成了百度google了一圈,因为没特定关键词,搜索了很多方法都没法解决.....没办法,作为中国的stackflow,只好死马当活马医了.........
阅读 8.5k
1 个回答

结论1:不是配置问题是win10问题,ubuntu正常
结论2:暂时不清楚是win10版本问题还是某个软件冲突,使用的是ltsc
结论3:nginx 对于超过10k的数据,被fiddler抓取返回[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏