Is the stale-while-revalidate working

What is the name of the domain?

cgn.inf.br

What is the issue you’re encountering

can`t use stale while revalidate

What steps have you taken to resolve the issue?

i have used headers like the documentation says but not work

What are the steps to reproduce the issue?

Follow the instructions in the documentation.

What are the necessary configurations? I’ve tried several ways to implement it but haven’t succeeded in any. Does anyone use it? Does it work?

Hi,

Thank you for reaching out to us. Currently, we can see the following:

HTTP/2 200
< date: Wed, 30 Oct 2024 10:17:14 GMT
< content-type: text/html; charset=UTF-8
< cf-ray: 8daaa780880c6936-LIS
< cf-cache-status: MISS
< cache-control: no-store, no-cache, must-revalidate, max-age=0, stale-while-revalidate=300, stale-if-error=86400
< last-modified: Thu, 29 Feb 2024 15:02:16 GMT
< link: https://cgn.inf.br/; rel=shortlink
< vary: Accept-Encoding
< via: 1.1 google
< cf-apo-via: origin,miss
< cgn-x-cache: BYPASS
< server: cloudflare

Your domain is currently using stale while revalidate directive in the cache-control header, but there’s still a few adjustments you can make. You need to remove the no store, and no cache which contradicts the purpose of stale while revalidate to allow caching. The max-age= 0 prevents caching, you should set a positive value to enable caching. So it should be something like: cache-control: max-age=3600 (1 hour), stale-while-revalidate=300, stale-if-error=86400 (the response will be fresh for 1 hour, it can be served stale for up to 5 minutes and in case of errors, it can be served stale for 24 hours, for example)

Since you’re using Cloudflare, make sure your caching settings align with your cache-control header. Also, you should consider using the ETag header for more accurate cache validation.

For more information, please refer to the following doc: Cloudflare cache responses

I hope this helps. Please let us know if you have further questions.

Kindly,

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.