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 16:12:37 UTC 2011
Thanks. Let me try this out.
On Wed, Dec 28, 2011 at 9:18 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> Hello!
>
> On Wed, Dec 28, 2011 at 08:44:07PM +0530, Quintin Par wrote:
>
>> 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;
>> }
>
> Most likely your backend gzips responses (if client supports
> gzipp), and these are getting cached.
>
> Possible solutions include disabling gzipping on backend or
> clearing Accept-Encoding header on nginx side before passing
> request to backend, i.e.
>
> proxy_set_header Accept-Encoding "";
>
> Maxim Dounin
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list