From 053dd0075c35a3f5a5dd67d68028d9e18886b738 Mon Sep 17 00:00:00 2001 From: schneems Date: Sun, 24 Aug 2014 15:42:39 -0500 Subject: [ci skip] docs CDN caching behavior --- guides/source/asset_pipeline.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'guides') diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 0db570a46c..9a22ec5700 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -1005,6 +1005,23 @@ option your asset helper, which overwrites value set in <%= asset_path 'image.png', host: 'mycdnsubdomain.fictional-cdn.com' %> ``` +#### Customize CDN Caching Behavior + +A CDN works by caching content. If the CDN has stale or bad content, then it is +hurting rather than helping your application. The purpose of this section is to +describe general caching behavior of most CDNs, your specific provider may +behave slightly differently. + +##### CDN Request Caching + +While a CDN is described as being good for caching assets, in reality caches the +entire request. This includes the body of the asset as well as any headers. The +most important one being `Cache-Control` which tells the CDN (and web browsers) +how to cache contents. This means that if someone requests an asset that does +not exist `/assets/i-dont-exist.png` and your Rails application returns a 404, +then your CDN will likely cache the 404 page if a valid `Cache-Control` header +is present. + Customizing the Pipeline ------------------------ -- cgit v1.2.3