Rails 3.1 Assets、Cache-Control、Max-Age 和 Expires 标头
我目前在 Heroku Cedar 堆栈上有一个与 Unicorn 一起运行的应用程序。
我还将 CloudFront 配置为自定义源来托管我的 css/js 资产。然而,似乎无论我以哪种方式配置 Rails 的静态/资产,它都不允许我设置 Cache-Control、Max-Age 或 Expires 标头。
这很重要,因为标头是通过 CloudFront 传递的,如果我无法设置它们,CloudFront 将无法正确缓存它们。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将其添加到您的environments/development.rb 文件中。
Try adding this to your environments/production.rb file.