Q:

disable nginx caching for certain file types

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

A:

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;

