Far Future Expiration Header for nginx

published Thursday, March 21, 2013

Rails 3.1+ and the Asset Pipeline is excellent to minify, merge, and deliver assets, however it's good to also leverage browser caching.

Using nginx, you can set a far future expiration header like this:

server {
  location ~ ^/(assets)/ {
    expires max;
  }
}