<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Cache-Control Header for Amazon S3</title>
	<atom:link href="http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/feed/" rel="self" type="application/rss+xml" />
	<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/</link>
	<description>Programming Wisdom for Mac OS X and Ruby on Rails Developers</description>
	<lastBuildDate>Fri, 17 Jul 2009 05:31:09 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: GoZuus Blog &#187; Caching Images Using Attachment_Fu and Amazon S3</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-794</link>
		<dc:creator>GoZuus Blog &#187; Caching Images Using Attachment_Fu and Amazon S3</dc:creator>
		<pubDate>Thu, 26 Mar 2009 15:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-794</guid>
		<description>[...] technique we use for setting the Cache-Control header was originally posted in this guide. We&#8217;ll enhance the AWS::S3 store method to add a Cache-Control header that&#8217;s 10 years [...]</description>
		<content:encoded><![CDATA[<p>[...] technique we use for setting the Cache-Control header was originally posted in this guide. We&#8217;ll enhance the AWS::S3 store method to add a Cache-Control header that&#8217;s 10 years [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keaka Jackson</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-427</link>
		<dc:creator>Keaka Jackson</dc:creator>
		<pubDate>Mon, 23 Jun 2008 17:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-427</guid>
		<description>It&#039;s been a while, but I believe you include a regular HTTP header in your HTTP PUT request.  So wherever your PHP class generates the actual request to Amazon, you&#039;d add a Cache-Control header to the request.

This &quot;Getting Started Guide&quot; has a &quot;Writing an Object&quot; section with PHP sample code you might be able to use:
http://docs.amazonwebservices.com/AmazonS3/2006-03-01/gsg/</description>
		<content:encoded><![CDATA[<p>It&#8217;s been a while, but I believe you include a regular HTTP header in your HTTP PUT request.  So wherever your PHP class generates the actual request to Amazon, you&#8217;d add a Cache-Control header to the request.</p>
<p>This &#8220;Getting Started Guide&#8221; has a &#8220;Writing an Object&#8221; section with PHP sample code you might be able to use:<br />
<a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/gsg/" rel="nofollow">http://docs.amazonwebservices.com/AmazonS3/2006-03-01/gsg/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-425</link>
		<dc:creator>Travis</dc:creator>
		<pubDate>Sat, 21 Jun 2008 09:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-425</guid>
		<description>Do you happen to know the procedure and in what API method the header is ultimately being set so that when the object is put to S3 it has that header stored? I am using a PHP class which works well but I can&#039;t figure out how to get my own custom headers (such as cache-control) to be included with the file...</description>
		<content:encoded><![CDATA[<p>Do you happen to know the procedure and in what API method the header is ultimately being set so that when the object is put to S3 it has that header stored? I am using a PHP class which works well but I can&#8217;t figure out how to get my own custom headers (such as cache-control) to be included with the file&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keaka Jackson</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-423</link>
		<dc:creator>Keaka Jackson</dc:creator>
		<pubDate>Wed, 18 Jun 2008 20:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-423</guid>
		<description>I mainly only use s3 for images, so I haven&#039;t had to deal with serving gzipped assets yet.</description>
		<content:encoded><![CDATA[<p>I mainly only use s3 for images, so I haven&#8217;t had to deal with serving gzipped assets yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Martinez</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-422</link>
		<dc:creator>Joe Martinez</dc:creator>
		<pubDate>Wed, 18 Jun 2008 02:54:48 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-422</guid>
		<description>What do you do about gzipping your s3 assets, or do you only use s3 for images?</description>
		<content:encoded><![CDATA[<p>What do you do about gzipping your s3 assets, or do you only use s3 for images?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Whiny Nil &#187; Blog Archive &#187; LINK: Cache-Control Header for Amazon S3</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-21</link>
		<dc:creator>The Whiny Nil &#187; Blog Archive &#187; LINK: Cache-Control Header for Amazon S3</dc:creator>
		<pubDate>Wed, 31 Oct 2007 14:12:46 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-21</guid>
		<description>[...] Cache-Control Header for Amazon S3Amazon provides an option for specifying the Cache-Control header, but we use the AWS::S3 gem and the attachment_fu plugin for uploading our files to S3. The gem and plugin don&#8217;t provide a convenient way to set the Cache-Control header. My solution is to enhance the behavior of the store() method within the AWS::S3 gem so that it always specifies a Cache-Control header of 10 years if another value is not specified. [...]</description>
		<content:encoded><![CDATA[<p>[...] Cache-Control Header for Amazon S3Amazon provides an option for specifying the Cache-Control header, but we use the AWS::S3 gem and the attachment_fu plugin for uploading our files to S3. The gem and plugin don&rsquo;t provide a convenient way to set the Cache-Control header. My solution is to enhance the behavior of the store() method within the AWS::S3 gem so that it always specifies a Cache-Control header of 10 years if another value is not specified. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian B. Danieli</title>
		<link>http://keakaj.com/wisdom/2007/07/27/cache-control-header-for-amazon-s3/comment-page-1/#comment-8</link>
		<dc:creator>Adrian B. Danieli</dc:creator>
		<pubDate>Thu, 13 Sep 2007 00:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://keakaj.com/wisdom/?p=3#comment-8</guid>
		<description>Nice. I wanted to add &quot;Expires&quot; as well (I know, old school) so here&#039;s a tweaked version that does it. This version forces the headers, and uses symbolized keys.

&lt;pre&gt;
require &#039;aws/s3&#039;

# Adds expiration headers to all stored S3 objects through duck-punching.
# Based on Keaka Jackson&#039;s original work.
#
module AWS::S3
  class S3Object
    class &lt;&lt; self
      MAX_AGE = 8.years
      def store_with_cache_control(key, data, bucket = nil, options = {})
        options[:cache_control] = &quot;max-age=#{MAX_AGE.to_i}&quot;
        options[:expires]       = MAX_AGE.from_now.httpdate
        store_without_cache_control(key, data, bucket, options)
      end
      alias_method_chain :store, :cache_control
    end
  end
end

# To update existing photos, run this in production script/console:
#
# Photo.find(:all).each do &#124;p&#124;
#   s3 = AWS::S3::S3Object.find(p.full_filename, &#039;bucketname&#039;)
#   s3.save(:access =&gt; :public_read) unless s3.cache_control &amp;&amp; s3.expires
# end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Nice. I wanted to add &#8220;Expires&#8221; as well (I know, old school) so here&#8217;s a tweaked version that does it. This version forces the headers, and uses symbolized keys.</p>
<pre>
require 'aws/s3'

# Adds expiration headers to all stored S3 objects through duck-punching.
# Based on Keaka Jackson's original work.
#
module AWS::S3
  class S3Object
    class < < self
      MAX_AGE = 8.years
      def store_with_cache_control(key, data, bucket = nil, options = {})
        options[:cache_control] = "max-age=#{MAX_AGE.to_i}"
        options[:expires]       = MAX_AGE.from_now.httpdate
        store_without_cache_control(key, data, bucket, options)
      end
      alias_method_chain :store, :cache_control
    end
  end
end

# To update existing photos, run this in production script/console:
#
# Photo.find(:all).each do |p|
#   s3 = AWS::S3::S3Object.find(p.full_filename, 'bucketname')
#   s3.save(:access => :public_read) unless s3.cache_control &#038;&#038; s3.expires
# end
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.509 seconds -->
