Vincent's blog

Cache-Control

I recently read "Your Cache Headers Could Probably Be More Aggressive", which serves as a good reminder to review the Cache-Control header of your websites. Below is a straightforward nginx configuration for this purpose.

location ~* \.(?:css|js|woff2|jpg|jpeg|png|gif|svg|mp4)$ {
    expires 1y;
    access_log off;
    add_header Cache-Control "public";
}