]> cat aescling's git repositories - mastodon.git/commitdiff
Enable immutable caching for S3 objects (#9722)
authorNolan Lawson <nolan@nolanlawson.com>
Sat, 5 Jan 2019 17:29:53 +0000 (09:29 -0800)
committernightpool <nightpool@users.noreply.github.com>
Sat, 5 Jan 2019 17:29:53 +0000 (12:29 -0500)
I also added "public" here, as I can't think of a good reason not to add it. Perhaps it has some marginal benefit in that ISPs (or other proxies) can cache it for all users. The assets are certainly publicly available and the same for all users.

config/initializers/paperclip.rb

index df0205879c43c8b3f2172470c78f580b1611a889..4bbf8b827b54aa23a5997edf383015684b70f3ba 100644 (file)
@@ -25,7 +25,7 @@ if ENV['S3_ENABLED'] == 'true'
     s3_protocol: s3_protocol,
     s3_host_name: s3_hostname,
     s3_headers: {
-      'Cache-Control' => 'max-age=315576000',
+      'Cache-Control' => 'public, max-age=315576000, immutable',
     },
     s3_permissions: ENV.fetch('S3_PERMISSION') { 'public-read' },
     s3_region: s3_region,