NIGHTMARE cache issue reverse proxy. Objects in cache replaced with 0 bytes and not being fetched from upstream

David Taveras d3taveras38d3 at gmail.com
Tue Apr 13 06:50:34 MSD 2010


Hello,

I have enabled caching, and now when I visit my page and I hit the
Shift key so that I force my browser to not use the local cache and
fetch all objects intermittently (happens randomly for objects)  some
of the objects after 1 or 2 refreshes with this method become 0 size.

After I "screw" the cache of nginx with this shift key the only way to
get a full page to load with all its objects is to clean the cache and
send a kill -HUP to the nginx pid .. or rm -fr the cache contents
directory and reboot the server.

When I look in the logs I see this:

124.40.68.228 www.mydomain.org - [08/Apr/2010:17:47:34 -0600] "GET
/images/split_main_footer.gif HTTP/1.1" 304 0
"http://www.mydomain.org/products.php" "Mozilla/5.0 (Windows; U;
Windows NT 5.1; es-ES; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
(.NET CLR 3.5.30729)" "0.000"

NOTICE the 304 response code given to me.. with a 0 byte size.

If I go into the server I can fetch the object from upstream with lynx
(no object is ever 0 size). This is the result of the header of that
particular object:

# lynx -dump -head http://www.mydomain.org/images/split_main_footer.gif
HTTP/1.1 200 OK
Date: 08 Apr 2010 17:48:48 GMT
Server: Apache
Last-Modified: Wed, 30 Dec 2009 17:03:27 GMT
ETag: "104b12-fee-47bf51dfa75c0"
Accept-Ranges: bytes
Content-Length: 4078
Cache-Control: max-age=3888000
Expires: Fri, 28 May 2010 02:32:48 GMT
Connection: close
Content-Type: image/gif



Here is the cache config portion:

 ## Proxy options
  proxy_buffering           on;


  proxy_cache_min_uses       1;
  proxy_cache_path          /var/log/nginx/cache_temp/ levels=1:2
keys_zone=cache:10m inactive=10m max_size=512M;

  proxy_ignore_client_abort off;
  proxy_intercept_errors    off;
  proxy_next_upstream       error timeout invalid_header;
  proxy_redirect            off;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_connect_timeout     60;
  proxy_send_timeout        60;
  proxy_read_timeout        60;

[.......]

proxy_cache            cache;



What could be causing this mess???

David



More information about the nginx mailing list