From 7131c1961672e57714b6d22ca80e6e9183e81d5b Mon Sep 17 00:00:00 2001 From: Mario Finelli Date: Sat, 8 Jun 2019 09:56:12 -0400 Subject: [PATCH] Add cache control to s3 objects --- CHANGELOG.md | 4 ++++ lib/bankrupt/tasks.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b60ecbd..383ff2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This file keeps track of changes between releases for the bankrupt project which adheres to [semantic versioning](https://semver.org). +## unreleased + +* Set cache-control header on objects uploaded to s3 (1 year). + ## v1.1.0 2019-06-05 Add support for `img` tags along with the ability to add other attributes. diff --git a/lib/bankrupt/tasks.rb b/lib/bankrupt/tasks.rb index 4acbf5e..a2a8875 100644 --- a/lib/bankrupt/tasks.rb +++ b/lib/bankrupt/tasks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2018 Mario Finelli +# Copyright 2018-2019 Mario Finelli # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ # content_md5: Base64.strict_encode64(asset[:md5]), content_length: File.size(f), content_type: MiniMime.lookup_by_filename(f).content_type, + cache_control: 'public, max-age=31536000', server_side_encryption: 'AES256', storage_class: 'STANDARD', metadata: {