
  # Set expires headers for assets
  # Assets with a digest (32 char hex string in filename) get max expires
  # Non-digest assets get 30 mins
  location ^~ /<%= @asset_pipeline_prefix %>/ {
    expires 30m;
    add_header Cache-Control public;
    gzip_static on;

    location ~ "-[0-9a-f]{32}\." {
      expires max;
    }
  }

<%= @nginx_extra_config %>


  # Set expires headers for assets
  # Assets with a digest (32+ char hex string in filename) get max expires
  # Non-digest assets get 30 mins
  location ^~ /<%= @asset_pipeline_prefix %>/ {
    expires 30m;
    add_header Cache-Control public;
    gzip_static on;

    location ~ "-[0-9a-f]{32,}\." {
      expires max;
    }
  }

<%= @nginx_extra_config %>

Fix assets cache-control header for Rails 4 assets.
Fix assets cache-control header for Rails 4 assets.

Starting with Rails 4, the digested asset files now use a 64 character
digest instead of the 32 character one that Rails 3 used. This meant
that they weren't matching the regex here, and therefore only getting a
30 minute cache TTL.

This updates the regex to match a digest that is 32 characters or longer
so that these assets also get a maximum cache TTL.
