disable nginx caching for certain file types

2019-02-22 09:38发布

问题:

I have nginx setup, acting as a reverse proxy to apache. However, I need to disable caching for gifs. How can I do this on nginx?

Thanks

回答1:

This should do the trick:

set $no_cache "";
if ($request_uri ~* \.gif$) {
  set $no_cache "1";
}
proxy_no_cache $no_cache;
proxy_cache_bypass $no_cache;


标签: caching nginx