question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cache-control immutable

See original GitHub issue

I am no expert but I see immutable on everything now. I believe adding cache-control immutable would improve performance. Apparently even with max age set, browsers will revalidate on a page reload and immutable helps stop that from happening: https://www.keycdn.com/blog/cache-control-immutable

Expected behaviour

responses should be cache-control: max-age=31536000,public,immutable

Actual behaviour

responses are cache-control: max-age=31536000,public

I don’t think there is any harm in setting it if public and max-age > 0.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kkopachevcommented, Jan 25, 2019

This seems like a useful feature.

1reaction
Enalmadacommented, Dec 8, 2018

@caeugusmao Thanks for the nginx tip. I think that is a great suggestion for everyone until it it is officially supported. I am adding it using the following commands:

   proxy_hide_header Cache-Control;
   add_header Cache-Control "public, max-age=31536000, immutable";

(I am no nginx expert and there is likely a better way to append immutable to the existing header but I found it easiest to hide the current one and add the new one to avoid duplicate)

Yes, if it is something you would want I will send a PR eventually. I wouldn’t be sad if one of you beat me to adding the “, immutable” to the cache string if you happen to be in the code area though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving Performance with Cache-Control: immutable
Cache-Control : immutable is an extension directive that prevents browsers from performing redundant conditional revalidation on static ...
Read more >
Cache-Control - HTTP - MDN Web Docs
immutable tells a cache that the response is immutable while it's fresh and avoids those kinds of unnecessary conditional requests to the server ......
Read more >
Cache-control Immutable Header - Stack Overflow
When a client supporting immutable sees this attribute it should assume that the resource, if unexpired, is unchanged on the server and ...
Read more >
headers HTTP header: Cache-Control: `immutable` - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
1 critical thing you need to know when using immutable caching
Headers sent by the server tell the browser if the content should be cached or should not be. This header, 'Cache-Control' can have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found