我正在尝试设置我的应用以通过Amazon S3/Cloudfront CDN提供资源.它是一个rails应用程序,我使用asset_sync
gem来实现这个heroku文档.
我将我的项目推送到heroku,然后运行一个heroku run rake assets:precompile
.这给了我看起来像这样的输出:
I, [2013-09-20T21:19:06.506796 #2] INFO -- : Writing /app/public/assets/application-cb6347d3ce9380e02c37364b541fd8ae.js
I, [2013-09-20T21:19:19.979570 #2] INFO -- : Writing /app/public/assets/application-9dc3068c1bf9290c7eb0493fd36b3587.css
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
Run Code Online (Sandbox Code Playgroud)
请注意,它为JS文件写的哈希cb6347d3ce9380e02c37364b541fd8ae.js
是正确的(因为我也在我的localhost下进行了暂存).
但问题是,当我在heroku上点击我的应用程序并检查源代码时,它所包含的JS与50460076f4c6eb614a44b6b17323efa7.js
之前编译的JS 不同...
为什么heroku没有使用正确的预编译资产?我在本地部署并执行了所有相同的步骤,我的本地服务器没有问题就选择了正确的JS.
谢谢你的帮助!