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.

Polyfill always fetched from source with 'age' header value higher than 'max-age' header value.

See original GitHub issue

When requesting https://cdn.polyfill.io/v2/polyfill.min.js?features=es5,es6,es7,default-3.6,Object.values&flags=gated&version=latest&unknown=ignore I see the following response headers:

accept-ranges:bytes
access-control-allow-origin:*
age:1099341
cache-control:public, s-maxage=31536000, max-age=604800, stale-while-revalidate=604800, stale-if-error=604800
content-encoding:br
content-length:978
content-type:application/javascript;charset=utf-8
date:Fri, 25 Aug 2017 15:37:54 GMT
server:Cowboy
status:200
strict-transport-security:max-age=31536000; includeSubdomains; preload
timing-allow-origin:*
vary:User-Agent
vary:Accept-Encoding
via:1.1 vegur
via:1.1 varnish
x-cache:HIT
x-cache-hits:1
x-content-type-options:nosniff
x-frame-options:sameorigin
x-served-by:cache-ams4135-AMS
x-timer:S1503675475.984820,VS0,VE0
x-xss-protection:1; mode=block

Because the age value is higher than the max-age value the response is never stored in browser cache and always fetched from the CDN.

Would it be possible to omit the age header?


update

Have done some more research on this. The ‘age’ header seems to be set by fastly. This seems an incorrect configuration to me as the current cache mechanic for polyfill.io is to store indefinitely in CDN and purge on update. Serving “stale”, as indicated by the response headers can’t be intentional.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
JakeChampioncommented, Sep 4, 2017

The release which has this fix will go out on Thursday 👍

2reactions
JakeChampioncommented, Sep 1, 2017

This is the correct channel however, I will look into this next week 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Cache-Control response header for `/_next/image`
If no max-age value is provided in a Cache-Control header returned by the image URL/path, a default max-age of 60 seconds is set....
Read more >
Access-Control-Max-Age - HTTP - MDN Web Docs
The Access-Control-Max-Age response header indicates how long the results of a preflight request (that is the information contained in the ...
Read more >
Caching effect on CORS: No 'Access-Control-Allow-Origin ...
User fetches CSS as part of a CORS request. The response comes from the cache. CORS check fails, no Access-Control-Allow-Origin header. The ...
Read more >
Caching Header Best Practices - Simon Hearne
Always set the Cache-Control header, preferably with the value max-age=31536000,immutable alongside unique asset filenames (or no-cache for non- ...
Read more >
Stale-While-Revalidate, Stale-If-Error Available Today - Fastly
This example tells the cache that if the re-fetch fails within three days of the response becoming stale, then the cached response should...
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