Nginx cached page returning binary data(.gz file) every now and then. Works when cached folder is deleted

Quintin Par quintinpar at gmail.com
Wed Dec 28 15:14:07 UTC 2011


I have an nginx server running as a proxy. A page from it is
configured to be cached and served compressed.
But then every now and then it serves the page as .gz file which shows
as up a file to be downloaded. A curl –I hit returns binary data.
  curl -I www.site.com/cs
But when I deleted the cache folder everything starts working fine.
  sudo rm -r /tmp/nginx/cscache/
What could be wrong? Can someone help?

This is the config
  location = /cs {
  proxy_pass http://localhost:82;
  proxy_set_header   Host             $host;
  proxy_set_header   X-Real-IP        $remote_addr;
  proxy_ignore_headers Set-Cookie;
  proxy_ignore_headers Cache-Control;
  proxy_ignore_headers Expires;
  proxy_ignore_headers X-Accel-Expires;
  add_header X-Cache-Status $upstream_cache_status;
  proxy_cache             cscache;
  proxy_cache_bypass       $http_cs;
  proxy_cache_key         $request_uri;
  proxy_cache_valid       200 302 1d;
  proxy_cache_valid       404      1m;
  proxy_cache_use_stale   error timeout invalid_header;
  }
And the result during a valid curl -I call.

  [c at c ~]$ curl -I www.site.com/cs
  HTTP/1.1 200 OK
  Server: nginx
  Date: Wed, 28 Dec 2011 14:49:39 GMT
  Content-Type: text/html; charset=utf-8
  Connection: keep-alive
  Keep-Alive: timeout=60
  Vary: Accept-Encoding
  Vary: Cookie,Accept-Encoding
  X-Mod-Pagespeed: 0.9.17.7-716
  Cache-Control: max-age=0, no-cache, no-store
  X-Cache-Status: MISS

Cross Posted: http://serverfault.com/questions/344705/nginx-cached-page-returning-binary-data-every-now-works-when-cached-folder-is-d



More information about the nginx mailing list