Skip to content
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

Add Cache-Control: immutable header #313

Open
GitBoudewijn opened this issue Oct 8, 2021 · 3 comments
Open

Add Cache-Control: immutable header #313

GitBoudewijn opened this issue Oct 8, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request triage This issue is being investigated

Comments

@GitBoudewijn
Copy link

https://images.weserv.nl/faq/#why-am-i-not-seeing-any-http-304-header-when-i-request-a-cached-image

Here in the FAQ it says that you don't use Last-Modified headers in order to prevent 304 requests, however if you take a look at the headers it actually does include Last-Modified:

https://redbot.org/?uri=https%3A%2F%2Fimages.weserv.nl%2F%3Furl%3Dimages.weserv.nl%2Flichtenstein.jpg

Is it supposed to be like that?

Also there's a new way to prevent 304 requests that you aren't using yet, which is adding immutable to the Cache-Control header.

The only downside is that Chrome doesn't support it yet and it's taking them a really long time (see http://bugs.chromium.org/p/chromium/issues/detail?id=611416), but it might be a good idea to add it anyway.

@andrieslouw
Copy link
Member

The Last-Modified is inserted by Cloudflare, and I do not see any If-Modified-Since-requests at our servers. So it seems that Cloudflare is intercepting these requests.

The Cache-Control: immutable looks promising, will monitor that one, but implementation in Chromium will be quite important (as proved by https://caniuse.com/mdn-http_headers_cache-control_immutable ).

@andrieslouw andrieslouw self-assigned this Oct 9, 2021
@andrieslouw andrieslouw added enhancement New feature or request triage This issue is being investigated labels Oct 9, 2021
@GitBoudewijn
Copy link
Author

I guess the Vary: Accept-Encoding header is added by Cloudflare as well? Since I don't think you use any encoding.

Chrome will just ignore the immutable directive so you could add it, but it probably won't have much benefit either. Otherwise you can just close this issue and I'll reopen it if the situation changes.

@kleisauke
Copy link
Member

Vary: Accept-Encoding is send by Cloudflare as well (but I couldn't find the reason why this is added, curious).

Let's leave this issue open. We can consider adding the Cache-Control: immutable header once it's supported by all modern web browsers.

@kleisauke kleisauke changed the title About the caching related headers Add Cache-Control: immutable header Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage This issue is being investigated
Development

No branches or pull requests

3 participants