Fastly hidden
Fastly is a developer-friendly, Varnish-based CDN that speeds up your site by delivering static, dynamic, and streaming content with the lowest recorded latency. We've built our network for the future with 10Gb Ethernet, multi-core CPUs, and all Solid State Drives (SSDs).
Our EngineYard integration allows you to:
- Cache anything (static & dynamic content, whole pages, APIs & more)
- Control and manage configuration via our API
- Monitor your performance with real-time analytics and logging (coming soon)
Sign up for an account and start improving your site performance today!
For more information, check out our documentation
Engineyard$50 minimum |
Bill based on request and bandwidth usage. See bandwidth and request pricing for more info. There is a $50 minimum per month. |
Fastly EngineYard Setup
Fastly supports serving static assets like stylesheets, scripts, images, videos, and other content that changes at predictable intervals, along with dynamic content that you can specify to refresh anytime. For more configuration information, see our Intro to Caching and CDNs article.
Fastly for Static Asset Delivery
The quickest way to accelerate your app with Fastly
Rails Asset Host
Adding Fastly with the asset pipeline (Rails 3.1+) is easy. The following shows how to configure Rails to serve assets from the Fastly CDN URL that we set up for you.
For a production environment, set the asset_host
in config/environments/production.rb
(it may be commented out by default):
config.action_controller.asset_host = EY::Config.get(:fastly, "FASTLY_CDN_URL")
This will enable asset serving from your Fastly CDN domain in production.
Cache-Control Headers
Depending on your specific requirements, you should set Cache-Control headers that are appropriate for your app.
You can do this in your environments config file.
config.static_cache_control = "public, max-age=2592000"
config.assets.digest = true
config.static_cache_control = "public, max-age=2592000"
tells Rails that all static assets are considered public and sets the TTL (how long to cache) for 2,592,000 seconds (30 days). While this may seem like a very long time, you don't have to worry about expiring assets, that's what the next line is for.
For advanced cache control tuning see our Cache Control Tutorial.
config.assets.digest = true
will tell Rails to take an MD5 sum of all your assets and add it to the filename. This way the asset is "fingerprinted" and if you ever change the file, the filename will change since it has a different "fingerprint."
For example, if you have a file called image.jpg
and its MD5 hash is 908e25f4bf641868d8683022a5b62f54
then the filename will be:
image-908e25f4bf641868d8683022a5b62f54.jpg
If you modify the asset in any way, the hash will change and so will the filename. By using digests, you don't have to worry about invalidating your own assets; the filename takes care of everything for you. For more information on this behavior, check the Rails Asset Pipeline Fingerprinting guide.
Final Notes
If you have content in your /public
directory that your web server does not serve, you should also set
config.serve_static_assets = true
Fastly for Dynamic Content Delivery
Supercharge your app
Fastly supports invalidating (purging) individual objects or the entire cache. This section helps you set it up for Rails apps.
For a primer on caching dynamic content, read our introduction.
Please see our blog post for information about dynamic API caching.
More info coming soon.
After installation through the Engineyard Add-ons interface, you need to log into the Fastly dashboard via the SSO link below and enter the configuration information for your CDN.
Enter your origin information (e.g. example.com) and we will finish configuring your CDN. CDNs are typically available to use 30 seconds after configuration completion.
With Fastly, your plan is calculated based on requests and data transfer with a $50 minimum monthly bill. See detailed pricing information for details.