Assets path issue with S3

徘徊边缘 提交于 2019-12-05 22:19:30

You are using Rails 3.2 so it is much easier now. Take out the asset_sync gem. Go to Amazon and look for the CloudFront section (instead of S3). This is their CDN front end. You may have set it up to use your S3 bucket before.

With Rails 3.2 all you have to do is setup a CloudFront to use an "Origin". With an origin you give the location of your application instead of a bucket. When a user requests a file from the CDN, then the CDN will go to your app get the file and add it to the CDN cache. Since Rails Assets uses a unique filename you will always have the most up to date file.

Put the CloudFront location into your rails app as the source for assets. Then deploy and let heroku compile your assets.

Put the following in your production.rb

  # Setup amazon CDN
  config.action_controller.asset_host = "xxxxxxxxxxxxx.cloudfront.net"
CupraR_On_Rails

To close the ticket I finally found the solution thanks to Heroku help. The solution is in this other ticket Why Heroku don't use the good manifest.yml

I hope it will help!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!