Nginx returns HTTP 200 with Content-Length: 0
dennis dang
dennis.dang1130 at gmail.com
Sat Jun 11 08:13:25 MSD 2011
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 at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110611/2f4eab2e/attachment-0001.html>
More information about the nginx
mailing list