Skip to content

consider setting cache-control:immutable #8655

Open

Description

@kralo

which is a cache-control extension implemented already in firefox. I think this is reasonable, as you already set a large cache expiration date Cache-Control: public, max-age=30672000

This could help reducing calls to the server resulting in 304 not-modified and thereby also reduce some privacy issues (less requests - less traceability)...


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

  1. drewfreyling commented on Aug 2, 2016

    @drewfreyling
    Contributor

    This is a good idea but might not be of real benefit until it is supported by more browsers as it is just a bunch of wasted bytes unless you use a recent version of Firefox.
    Chrome doesn't seem to be in a hurry - https://bugs.chromium.org/p/chromium/issues/detail?id=611416

  2. PeterDaveHello commented on Aug 3, 2016

    @PeterDaveHello
    Contributor

    cc @cdnjs/owners @terinjokes

  3. terinjokes commented on Aug 9, 2016

    @terinjokes
    Contributor

    This looks pretty cool.

    I don't think we should implement it until I change the backend to reduce the update failures we have from time to time (and, perhaps, officially supporting "latest")

  4. dima74 commented on May 1, 2017

    @dima74

    Hello! What about adding Cache-Control: immutable only when user-agent is Firefox?

  5. PeterDaveHello commented on May 21, 2017

    @PeterDaveHello
    Contributor

    Hi @terinjokes, I think it'll be great to enable it no matter it the backend on Cloudflare side changes as this can really help improve performance by reducing the cache validation, am I right?

  6. MattIPv4 commented on Mar 2, 2019

    @MattIPv4
    Member

    @PeterDaveHello Chrome still does not have this implemented, should I raise this to Cf to ask them to set Cache control to be immutable when a Firefox UA is detected?

  7. MatthewSteeples commented on Apr 25, 2019

    @MatthewSteeples
  8. self-assigned this
    on Apr 25, 2019
  9. MattIPv4 commented on Apr 25, 2019

    @MattIPv4
    Member

    @MatthewSteeples Yeah, I think it best we implement it as it should improve performance. I will contact Cf and post any updates here :)

  10. MattIPv4 commented on Apr 6, 2020

    @MattIPv4
    Member

    @xtuc would you be able to help with getting this added?

  11. assigned and unassigned on Apr 6, 2020
  12. MattIPv4 commented on Apr 6, 2020

    @MattIPv4
    Member

    Currently, we send cache-control: public, max-age=30672000. Looking at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Caching_static_assets it should be safe to append , immutable.

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Extension_Cache-Control_directives notes that if a UA doesn't recognize immutable, it should just be ignored, so it'd fall back to the long max-age we are sending.

    (I'm no expert on this though)

  13. xtuc commented on Apr 6, 2020

    @xtuc
    Member

    @MattIPv4 that sound right. I sent the header to my Chrome and it didn't fail. That said, I'm not sure how to check that it works

  14. MattIPv4 commented on Apr 6, 2020

    @MattIPv4
    Member

    @xtuc Simple. Just wait a year and see if it expires. /s

  15. MattIPv4 commented on Apr 6, 2020

    @MattIPv4
    Member

    Chrome's dev tools should show if the resource was fetched from cache or not, but I'm not sure of any way to really confirm how long it's planning to hold the resource for in cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions