2

In a Rails 3.2 app I'm using asset_sync to host my assets on S3, and Cloudfront to distribute these assets, accessible via 4 CNAME'd URLs. It has been a good way of increasing the app's performance and reducing load on the server.

I'm now beginning to explore offline capabilities and HTML5 cache manifest. Obviously the cache manifest can be used to serve the static assets to repeat visitors.

I have two questions:

  1. Can these two approaches be used together? i.e., the first time a user visits the app, assets are downloaded from the cloudfront CDN. Thereafter, assets are served from the cache manifest. There appear to be conflicting reports across the internet as to whether the manifest file and assets need to be on the same sub-domain. My app is at http://app.example.com, whereas my assets are at http://asset0.example.com, http://asset1.example.com, etc.
  2. Secondly, how should I handle the unique ID applied to assets? For example, assets have names such as http://asset1.example.com/assets/application-hdggajdjd7672h12bsud8.js. Do I need to handle these random strings to ensure assets are properly cached, or are these strings created when updates are pushed to the server and assets precompiled, hence will remain static unless changes are made to the files.
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185

0 Answers0