Thomas
Thomas

Reputation: 4719

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

Upvotes: 7

Views: 5780

Answers (1)

Artem Russakovskii
Artem Russakovskii

Reputation: 22013

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;

Upvotes: 7

Related Questions