Forum: Ruby on Rails Add expire header for images stored in amazon s3

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ce47044a11f24447e118f412b01b992f?d=identicon&s=25 Maddy (Guest)
on 2012-12-17 10:08
(Received via mailing list)
Hi everyone Good Afternoon,

  I done adding expire header by put the following code into my product
model.

    :s3_headers => { 'Cache-Control' => 'max-age=315576000', 'Expires'
=>
10.years.from_now.httpdate },

  But its work only while i add new product and image.
  Already i have 100 of products and images. How can i add expire header
for those which already exist products.

Please advice.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2012-12-17 13:41
(Received via mailing list)
On Monday, December 17, 2012 9:07:07 AM UTC, Maddy wrote:
>   But its work only while i add new product and image.
>   Already i have 100 of products and images. How can i add expire header
> for those which already exist products.
>
>
You'll have to iterate over all the files in question and set their
expires
for them. If you use the copy operation to copy a file to itself then S3
will just update the metadata on the file. There are also various
graphical
frontends to S3 that can probably do this sort of bulk operation but I
am
not familiar with them

Fred
This topic is locked and can not be replied to.