-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable immutable caching for S3 objects #9722
Conversation
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 |
Here is another good explanation of |
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_>
.
|
Yes but it's not cacheable by proxies, since the proxy doesn't know if users A and B see the exact same thing when requesting resource X. |
right, but it's already a cacheable request and intermediaries are free to do whatever, because it has a max-age directive. public is just duplicating that. anyway, whatever, it's not a huge deal |
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 |
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.
Thanks for merging my last PR! I found a couple more things that folks should do when migrating to S3. This adds the proper caching header, as defined in the latest version of Mastodon: mastodon/mastodon#9722 . It also ensures that non-custom emoji are properly served with immutable caching via nginx. It's no fun going back and recursively adding the right cache headers to every object in S3; hopefully this will save some folks that extra step. 😅
Thanks for merging my last PR! I found a couple more things that folks should do when migrating to S3. This adds the proper caching header, as defined in the latest version of Mastodon: mastodon/mastodon#9722 . It also ensures that non-custom emoji are properly served with immutable caching via nginx. It's no fun going back and recursively adding the right cache headers to every object in S3; hopefully this will save some folks that extra step. 😅
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.
Fixes #9721
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.