Nginx returns HTTP 200 with Content-Length: 0

Hi guys,

I configured nginx to be used as HTTP reverse proxy on Amazon EC2, the
back
end servers are somewhere on the Internet. The problem I’m facing is
that
nginx sometimes returns HTTP 200 with Content-Length: 0 for a while, and
the
duration is approximately 5 minutes( when “proxy_cache_valid 200 301
5m;” is
configured in server section), or 10 minutes(when “proxy_cache_valid 200
301
10m;” is configured in server section). I really have no idea why this
happens. Any information is appreciated.

I tried to analyze the network packet flows, it seems nginx didn’t
contact
the upstream servers in these situations.
The curl log is:
localhost:DX dennis$ curl -I $aptokyo002
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 11 Jun 2011 03:38:48 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.1.6
Content-Length: 0
Expires: Sat, 11 Jun 2011 03:48:48 GMT
Cache-Control: max-age=600
Cache-Status: cached

localhost:DX dennis$
localhost:DX dennis$ curl -vI $aptokyo002

  • About to connect() to 175.41.241.137 port 80 (#0)
  • Trying 175.41.241.137… connected
  • Connected to 175.41.241.137 (175.41.241.137) port 80 (#0)

HEAD / HTTP/1.1
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
OpenSSL/0.9.8l zlib/1.2.3
Host: 175.41.241.137
Accept: /

< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: nginx
Server: nginx
< Date: Sat, 11 Jun 2011 03:38:52 GMT
Date: Sat, 11 Jun 2011 03:38:52 GMT
< Content-Type: text/html
Content-Type: text/html
< Connection: keep-alive
Connection: keep-alive
< X-Powered-By: PHP/5.1.6
X-Powered-By: PHP/5.1.6
< Content-Length: 0
Content-Length: 0
< Expires: Sat, 11 Jun 2011 03:48:52 GMT
Expires: Sat, 11 Jun 2011 03:48:52 GMT
< Cache-Control: max-age=600
Cache-Control: max-age=600
< Cache-Status: cached
Cache-Status: cached
localhost:DX dennis$

The nginx logs:
[ec2-user@aptokyo002 ~]$ tail -n 50 /var/log/nginx/dx.access.geoip.log
84.246.230.247 - - [11/Jun/2011:02:32:57 +0000] [FR] “GET / HTTP/1.0”
200
108415 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
173.204.85.217 - - [11/Jun/2011:02:34:42 +0000] [US] “GET / HTTP/1.0”
200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
173.248.147.18 - - [11/Jun/2011:02:35:41 +0000] [US] “GET / HTTP/1.0”
200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
72.46.130.42 - - [11/Jun/2011:02:36:41 +0000] [US] “GET / HTTP/1.0” 200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
94.46.240.121 - - [11/Jun/2011:02:37:42 +0000] [ES] “GET / HTTP/1.0” 200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
208.43.68.59 - - [11/Jun/2011:02:38:42 +0000] [US] “GET / HTTP/1.0” 200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.228.213.178 - - [11/Jun/2011:02:39:41 +0000] [US] “GET / HTTP/1.0”
200
108176 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
96.31.66.245 - - [11/Jun/2011:02:40:42 +0000] [US] “GET / HTTP/1.0” 200
108214 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
82.103.128.63 - - [11/Jun/2011:02:41:42 +0000] [DK] “GET / HTTP/1.0” 200
108214 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
174.34.156.130 - - [11/Jun/2011:02:42:42 +0000] [US] “GET / HTTP/1.0”
200
108214 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
70.32.40.2 - - [11/Jun/2011:02:43:45 +0000] [US] “GET / HTTP/1.0” 200
108214
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
174.34.162.242 - - [11/Jun/2011:02:44:42 +0000] [US] “GET / HTTP/1.0”
200
108214 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
85.25.176.167 - - [11/Jun/2011:02:45:42 +0000] [DE] “GET / HTTP/1.0” 200
108214 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
204.152.200.42 - - [11/Jun/2011:02:46:42 +0000] [US] “GET / HTTP/1.0”
200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
74.53.193.66 - - [11/Jun/2011:02:47:42 +0000] [US] “GET / HTTP/1.0” 200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
74.52.50.50 - - [11/Jun/2011:02:48:42 +0000] [US] “GET / HTTP/1.0” 200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
83.170.113.102 - - [11/Jun/2011:02:49:45 +0000] [GB] “GET / HTTP/1.0”
200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
95.211.87.85 - - [11/Jun/2011:02:50:43 +0000] [NL] “GET / HTTP/1.0” 200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
207.218.231.170 - - [11/Jun/2011:02:51:42 +0000] [US] “GET / HTTP/1.0”
200
108361 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
207.97.207.200 - - [11/Jun/2011:02:52:44 +0000] [US] “GET / HTTP/1.0”
200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.192.120.134 - - [11/Jun/2011:02:53:41 +0000] [US] “GET / HTTP/1.0”
200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
78.136.27.223 - - [11/Jun/2011:02:54:42 +0000] [GB] “GET / HTTP/1.0” 200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.205.112.79 - - [11/Jun/2011:02:55:42 +0000] [CA] “GET / HTTP/1.0” 200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
83.140.19.38 - - [11/Jun/2011:02:56:47 +0000] [SE] “GET / HTTP/1.0” 200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
69.59.28.19 - - [11/Jun/2011:02:57:42 +0000] [US] “GET / HTTP/1.0” 200
108255 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
178.255.154.2 - - [11/Jun/2011:02:58:44 +0000] [AT] “GET / HTTP/1.0” 200
0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.192.120.134 - - [11/Jun/2011:02:58:48 +0000] [US] “GET / HTTP/1.0”
200 0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
178.255.154.2 - - [11/Jun/2011:02:58:49 +0000] [AT] “GET / HTTP/1.0” 200
0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.192.120.134 - - [11/Jun/2011:02:58:49 +0000] [US] “GET / HTTP/1.0”
200 0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
178.255.153.2 - - [11/Jun/2011:02:59:41 +0000] [AT] “GET / HTTP/1.0” 200
0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
178.255.155.2 - - [11/Jun/2011:03:00:41 +0000] [AT] “GET / HTTP/1.0” 200
0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
64.237.55.3 - - [11/Jun/2011:03:01:41 +0000] [US] “GET / HTTP/1.0” 200 0
“-”
“Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
178.255.152.2 - - [11/Jun/2011:03:02:41 +0000] [AT] “GET / HTTP/1.0” 200
0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
64.141.100.136 - - [11/Jun/2011:03:03:35 +0000] [CA] “GET / HTTP/1.0”
200 0
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
212.84.74.156 - - [11/Jun/2011:03:04:45 +0000] [GB] “GET / HTTP/1.0” 200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
84.246.230.247 - - [11/Jun/2011:03:04:59 +0000] [FR] “GET / HTTP/1.0”
200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
173.204.85.217 - - [11/Jun/2011:03:06:41 +0000] [US] “GET / HTTP/1.0”
200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
173.248.147.18 - - [11/Jun/2011:03:07:41 +0000] [US] “GET / HTTP/1.0”
200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
72.46.130.42 - - [11/Jun/2011:03:08:41 +0000] [US] “GET / HTTP/1.0” 200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
94.46.240.121 - - [11/Jun/2011:03:09:43 +0000] [ES] “GET / HTTP/1.0” 200
107984 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
208.43.68.59 - - [11/Jun/2011:03:10:42 +0000] [US] “GET / HTTP/1.0” 200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
67.228.213.178 - - [11/Jun/2011:03:11:42 +0000] [US] “GET / HTTP/1.0”
200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
96.31.66.245 - - [11/Jun/2011:03:12:42 +0000] [US] “GET / HTTP/1.0” 200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
82.103.128.63 - - [11/Jun/2011:03:13:42 +0000] [DK] “GET / HTTP/1.0” 200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
174.34.156.130 - - [11/Jun/2011:03:14:42 +0000] [US] “GET / HTTP/1.0”
200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
70.32.40.2 - - [11/Jun/2011:03:15:42 +0000] [US] “GET / HTTP/1.0” 200
108156
“-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
174.34.162.242 - - [11/Jun/2011:03:16:42 +0000] [US] “GET / HTTP/1.0”
200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
85.25.176.167 - - [11/Jun/2011:03:17:42 +0000] [DE] “GET / HTTP/1.0” 200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
204.152.200.42 - - [11/Jun/2011:03:18:41 +0000] [US] “GET / HTTP/1.0”
200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
74.53.193.66 - - [11/Jun/2011:03:19:42 +0000] [US] “GET / HTTP/1.0” 200
108156 “-” “Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)” “-”
[ec2-user@aptokyo002 ~]$

And also I’m having another problem with nginx. In nginx logs, it seems
that
there’s a loop when retrieving error page. Here’s part of the logs:
94.178.189.90 - - [06/Jun/2011:04:50:48 -0500] [UA] “GET
/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html
HTTP/1.1” 400 11 “-” “Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.8.131
Version/11.11” “-”
94.178.189.90 - - [06/Jun/2011:04:50:50 -0500] [UA] “GET /favicon.ico
HTTP/1.1” 200 1150 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.8.131 Version/11.11” “-”
203.215.201.194 - - [06/Jun/2011:05:08:53 -0500] [KR] “GET
/rss.dx/error/error/error/500.html HTTP/1.1” 200 186762 “-” “HanRSS/1.1
(
http://www.hanrss.com; 9 subscribers)” “-”
193.179.104.82 - - [06/Jun/2011:05:10:58 -0500] [CZ] “GET
/accounts/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html
HTTP/1.1” 400 11 “-” “Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131
Version/11.11” “-”
193.179.104.82 - - [06/Jun/2011:05:11:00 -0500] [CZ] “GET /favicon.ico
HTTP/1.1” 200 1150 "
http://mysite.com/accounts/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html"
“Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11” “-”
72.14.199.84 - - [06/Jun/2011:05:12:57 -0500] [US] “GET
/rss.dx/error/error/error/error/error/error/error/500.html HTTP/1.1” 200
186777 “-” “Feedfetcher-Google;
(+http://www.google.com/feedfetcher.html; 1
subscribers; feed-id=4809723988274255381)” “-”
83.149.192.6 - - [06/Jun/2011:05:18:34 -0500] [RU] “GET / HTTP/1.1” 200
19774 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1”
“-”
83.149.192.6 - - [06/Jun/2011:05:19:07 -0500] [RU] “GET
/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html
HTTP/1.1” 404 850 “http://mysite.com/” “Mozilla/5.0 (Windows NT 5.1;
rv:2.0.1) Gecko/20100101 Firefox/4.0.1” “-”
83.149.192.6 - - [06/Jun/2011:05:19:07 -0500] [RU] “GET /error/error.css
HTTP/1.1” 200 616 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1”
“-”
83.149.192.6 - - [06/Jun/2011:05:19:07 -0500] [RU] “GET
/images/RRLOGO.gif
HTTP/1.1” 200 2566 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1”
“-”
83.149.192.6 - - [06/Jun/2011:05:19:08 -0500] [RU] “GET /images/404.png
HTTP/1.1” 200 50004 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1”
“-”
83.252.85.88 - - [06/Jun/2011:05:35:53 -0500] [SE] “GET
/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html
HTTP/1.1” 400 11 “https://mysite.com/c/weird-stuffs-1100” “Mozilla/5.0
(X11;
U; Linux x86_64; sv-SE; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10
(maverick)
Firefox/3.6.17” “-”
88.195.177.186 - - [06/Jun/2011:05:39:39 -0500] [FI] “GET
/rss.dx/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html
HTTP/1.1” 200 186769 “-” “Opera/9.80 (X11; Linux i686; U; en)
Presto/2.8.131
Version/11.11” “-”
31.163.114.250 - - [06/Jun/2011:05:58:52 -0500] [RU] “GET
/c/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html
HTTP/1.1” 400 11 “-” “Opera/9.80 (Windows NT 6.1; U; MRA 5.8 (build
4120);
ru) Presto/2.8.131 Version/11.11” “-”
31.163.114.250 - - [06/Jun/2011:05:58:53 -0500] [RU] “GET /favicon.ico
HTTP/1.1” 200 1150 "
http://mysite.com/c/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Opera/9.80 (Windows NT 6.1; U; MRA 5.8 (build 4120); ru) Presto/2.8.131
Version/11.11” “-”
78.29.11.126 - - [06/Jun/2011:06:01:31 -0500] [RU] “GET
/c/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html
HTTP/1.0” 404 1600 "
http://mysite.com/c/air-refresheners-700?page=1&pagesize=52&pagesort=relevence"
“Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.16)
Gecko/20110319
Firefox/3.6.17” “109.191.163.219”
78.29.11.126 - - [06/Jun/2011:06:01:41 -0500] [RU] “GET
/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html
HTTP/1.0” 404 1600 "
http://mysite.com/c/air-refresheners-700?page=2&pagesize=52&pagesort=relevence"
“Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.16)
Gecko/20110319
Firefox/3.6.17” “109.191.163.219”
78.29.11.126 - - [06/Jun/2011:06:01:58 -0500] [RU] “GET /error/error.css
HTTP/1.0” 200 616 "
http://mysite.com/c/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/500.html"
“Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.16)
Gecko/20110319
Firefox/3.6.17” “109.191.163.219”
83.149.192.6 - - [06/Jun/2011:06:09:27 -0500] [RU] “GET / HTTP/1.1” 200
19884 "
http://mysite.com/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html"
“Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1”
“-”
83.149.192.6 - - [06/Jun/2011:06:09:44 -0500] [RU] “GET
/p/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/error/404.html
HTTP/1.1” 404 850 “http://mysite.com/” “Mozilla/5.0 (Windows NT 5.1;
rv:2.0.1) Gecko/20100101 Firefox/4.0.1” “-”
[dhw@gw3 ~]$

The path of error pages have been configured as, and there’s
/www/htdocs/error/404.html and /www/htdocs/error/500.html.
server {

root /www/htdocs;
error_page 404 /404.html;
location = /404.html {
root /www/htdocs/error;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /www/htdocs/error;
}

}

thanks in advance,
dennis

I met the same problem. Client got http 200 response, but the
Content-Length: 0.
I never define this. I don’t why? Is there anybody know how to fix it?
Thanks in advance.

Posted at Nginx Forum:

It’s not always happen, the possibility of this phenomenon is 0.081%.
I havn’t any idea about this…

Posted at Nginx Forum:

Do you have SPDY enabled? I have experienced issues with SPDY, upstream
keepalive and proxy_cache together. Ended up having to turn off SPDY.

Posted at Nginx Forum:

I never use SPDY. The problem still exists. I don’t know how to fix it.

Posted at Nginx Forum:

I don’t use SPDY. My request is POST.

Posted at Nginx Forum:

If your request is post, Content-Length: 0 is normal.

2013/5/21 apeman [email protected]

it’s GET request?

2013/5/20 apeman [email protected]

no, no, no!
Normally, it’s not 0, but sometimes, the possibility is 0.07%. It’s
absolutely not normal!
[21/May/2013:00:02:56 +0800] “POST /ourservice/api HTTP/1.1” 200 607 27
“-”
“c” “10.23.130.154”
[21/May/2013:00:02:56 +0800] “POST /ourservice/api HTTP/1.1” 200 613 27
“-”
“c” “10.59.24.83”
[21/May/2013:00:02:56 +0800] “POST /ourservice/api HTTP/1.1” 200 604 62
“-”
“e” “10.197.218.20”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.1” 200 491 27
“-”
“f” “-”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.1” 200 612 278
“-”
“f” “10.165.21.34”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.0” 200 816 27
“-”
“c” “10.26.152.101”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.1” 200 585 27
“-”
“c” “10.67.55.190”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.1” 200 463 211
“-”
“f” “-”
[21/May/2013:00:02:57 +0800] “POST /ourservice/api HTTP/1.1” 200 596 0
“-”
“f” “10.181.30.95”
You see the last column, the response content-length is 0. And we can’t
find
the record in tomcat log. It seems nginx don’t forward the request to
tomcat.

Posted at Nginx Forum:

Hello!

On Tue, May 21, 2013 at 09:56:59PM -0400, apeman wrote:

“f” “-”
You see the last column, the response content-length is 0. And we can’t find
the record in tomcat log. It seems nginx don’t forward the request to
tomcat.

You may want to capture debug log to see what goes on, see
A debugging log for details.

See also Debugging | NGINX.


Maxim D.
http://nginx.org/en/donation.html

we just encountered the same problem at 0.002% level, solved it by
removing
following line in conf file:

“gzip_http_version 1.0”

very wired problem, still not understand the true reason

Posted at Nginx Forum:

Hello all,

I have some problem , I use version nginx/1.2.2 and nginx/1.0.11, should
I
upgrade my version first or just compile then send you my debug log

thanks,

Rizki

Posted at Nginx Forum:

I had a very similar problem using nginx to front rainbows/rails. Even
though rails was definitely returning a JSON response, ngnix always
responded with 200 OK, Content-Length: 0, and an empty body.

The strange thing was that the error was related to the size of the
incoming
POST. When the request body was small everything worked fine, the full
response from Rails appeared. But as soon as the request was >100kb the
response was always blank.

In my case, the logs were filled with errors like “readv() failed (104:
Connection reset by peer) while reading upstream.” That error led me to
this post
post - Error: readv() failed (104: Connection reset by peer) while reading upstream - Stack Overflow.
It turns out that if you do not read incoming POST data (in Rails,
using
request.body.read) this will cause the “connection reset” error which in
turn results in a blank response body.

Posted at Nginx Forum: