skip to Main Content

Request headers:

:method: GET 
:path: /foo.webp
priority:i
sec-ch-ua: "Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-dest: image
sec-fetch-mode: no-cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Response headers:

access-control-allow-origin:*
age: 15644
allow: GET|HEAD
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
cache-control: public,max-age=3600
content-length: 13546
content-type: image/webp
date: Wed, 09 Oct 2024 18:44:03 GMT
server: nginx
via: 1.1 google

This images is fetched from the CDN each time I refresh the site, so browser caching is not working. Why?

2

Answers


  1. Chosen as BEST ANSWER

    Solution: clientTtl = maxTtl fixed the issue. A default Client TTL = 3600 overrided the max-ttl returned by a server


  2. Unlike curl, Chrome and Firefox both have built-in caches, so the fact that subsequent requests are served from those caches might be confusing your results.The cache-control: public, max-age=3600 header indicates that the image can be cached for an hour. If the image is being fetched again before that hour is set up, there may be a different issue causing it not to cache.

    Ensure that the cache settings in your browser allow for the image caching. And if your browser is set to always check for new content (through a developer option) it may bypass the cache.For more troubleshooting refer to this.

    Also it depends of the cache mode, if you set the cache mode to FORCE_CACHE_ALL, the default time to live (TTL) for content caching is 3600 seconds (1 hour), unless you explicitly set a different TTL, also I will share with you the TTL overrides document that give you fine-grained control over how long Cloud CDN caches your content before revalidating it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search