Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Enable immutable caching for S3 objects #9722
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.
I don't think public adds any benefit here, since we already have a max-age directive? otherwise lgtm…
On Sat, Jan 5, 2019, 12:18 PM Nolan Lawson ***@***.***> wrote: @nolanlawson <https://github.com/nolanlawson> requested your review on: #9722 <#9722> Enable immutable caching for S3 objects. — You are receiving this because your review was requested. Reply to this email directly, view it on GitHub <#9722 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAORV7beATRwGja-kjQEqL-OIqSXvA9eks5vAN5QgaJpZM4Zxv7_> .
Well they already effectively are, since if you know the URL then you can request it.
The main point of
Otherwise it makes no difference to the browser's cache; the browser can cache regardless of whether it's
right, bit it's already cacheable since it has the max age directive, right?…
On Sat, Jan 5, 2019, 12:25 PM Nolan Lawson ***@***.***> wrote: Well they already effectively are, since if you know the URL then you can request it. The main point of Cache-Control: public is that it tells proxies they are allowed to cache the URL for all users. So e.g. if my router decides to do this, and my wife and I are both using the same router, and I request resource X, and then she requests resource X, the router may decide to serve her the cached version. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Cacheability Otherwise it makes no difference to the browser's cache; the browser can cache regardless of whether it's public or private. — You are receiving this because your review was requested. Reply to this email directly, view it on GitHub <#9722 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAORV2lUS3Ou7uQIn4wLal1yYAJKg4Fmks5vAN_wgaJpZM4Zxv7_> .
Jan 5, 2019
11 checks passed
added a commit
this pull request
Jan 5, 2019
It just occurred to me that this may be a moot point for HTTPS anyway. I can't seem to find any info on how proxies handle
Then again, some admins may be using S3 with HTTP rather than HTTPS. And in either case I don't think there's any harm with adding
BTW for the benefit of Mastodon admins reading this issue who may want to add this header to existing S3 assets, you can use this
s3cmd --recursive modify --add-header="Cache-Control:public, max-age=315576000, immutable" s3://my-bucket-name/
Note that you will want the latest version of
git clone https://github.com/s3tools/s3cmd.git sudo apt install python-dateutil ./s3cmd/s3cmd --help