Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1 Assets, Cache-Control, Max-Age and Expires headers

I currently have an app on Heroku Cedar stack running with Unicorn.

I also have CloudFront configured as a custom origin to host my css/js assets. However it seems like no matter which way I configure the static/assets for Rails it will not allow me to set the Cache-Control, Max-Age or Expires headers.

This is important as the headers are pass-through with CloudFront and if I can't set them CloudFront won't cache them properly.

like image 873
Chad Moran Avatar asked Oct 15 '11 20:10

Chad Moran


1 Answers

Try adding this to your environments/production.rb file.

config.static_cache_control = "public, max-age=3600"
like image 181
jfeust Avatar answered Oct 27 '22 00:10

jfeust