aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2014-08-24 15:44:32 -0500
committerschneems <richard.schneeman@gmail.com>2014-08-24 15:44:32 -0500
commitfa704ed6f4568dbabce713f7c4788575e91c09af (patch)
treed72a33d9013cf39d4f1b872d01774b74952f749b /guides
parent8c2b3c9178a9628f44c8880ddb8e79f379a54b99 (diff)
downloadrails-fa704ed6f4568dbabce713f7c4788575e91c09af.tar.gz
rails-fa704ed6f4568dbabce713f7c4788575e91c09af.tar.bz2
rails-fa704ed6f4568dbabce713f7c4788575e91c09af.zip
[ci skip] docs can URL cache invalidation
Diffstat (limited to 'guides')
-rw-r--r--guides/source/asset_pipeline.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 389e64f1b4..c5985ddaf4 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -1094,6 +1094,30 @@ asset for up to a year. Since most CDNs also cache headers of the request, this
the browser then knows that it can store this asset for a very long time before
needing to re-request it.
+##### CDNs and URL based Cache Invalidation
+
+Most CDNs will cache contents of an asset based on the complete URL. This means
+that a request to
+
+```
+http://mycdnsubdomain.fictional-cdn.com/assets/smile-123.png
+```
+
+Will be a completely different cache from
+
+```
+http://mycdnsubdomain.fictional-cdn.com/assets/smile.png
+```
+
+If you want to set far future `max-age` in your `Cache-Control` (and you do).
+Then make sure when you change your assets that your cache is invalidated. For
+example when changing the smiley face in an image from yellow to blue, you want
+all visitors of your site to get the new blue face. When using a CDN with a the
+Rails asset pipeline `config.assets.digest` is set to true by default so that
+each asset will have a different file name when it is changed. This way you
+don't have to ever manually invalidate any items in your cache. By using a
+different unique asset name instead, your users get the latest asset.
+
Customizing the Pipeline
------------------------