Reputation: 6276
I use Nginx config to set js, css expires header
location ~* \.(js|css)$ {
expires 30d;
}
How can I skip specific files (ex: abc.js, style.css) from being cached?
Upvotes: 2
Views: 8889
Reputation: 71
This should do it.
location ~* \.(js|css)$ {
expires 30d;
}
location = /path/to/abc.js { expires off; }
location = /path/to/style.css { expires off; }
See the location documentation for a full explanation.
Upvotes: 2
Reputation: 12775
Try:
location ~* \.(js|css)$ {
location ~* (file\.js|name\.css)$ {
expires off;
}
expires 30d;
}
or
location ~* (file\.js|name\.css)$ {
expires off;
}
location ~* \.(js|css)$ {
expires 30d;
}
Upvotes: 4