Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting staleWhileRevalidate in the configuration does not actually set stale-while-revalidate #22131

Open
1 task done
flavianh opened this issue Feb 6, 2025 · 1 comment
Labels
P3 - Medium [triage] Bugs which we'll fix soon

Comments

@flavianh
Copy link

flavianh commented Feb 6, 2025

Issue Summary

In order to leverage Cloudflare edge cache for a request to / and avoid overloading my server with requests, I would like to set some level of staleness to my cache (in the absence of Last Modified of E-tag headers on ghost's part).

Steps to Reproduce

  1. Set this configuration
...
"caching": {
    "frontend": {
      "maxAge": 86400,
      "staleWhileRevalidate": 300
    }
}
  1. Notice that maxAge changes when requesting index.html but stale-while-revalidate is not set.

This is unexpected as staleWhileRevalidate is listed as an option in the cache middleware:

* @param {number} [options.staleWhileRevalidate] The stale-while-revalidate in seconds to use when profile is "public"

Ghost Version

5.108.2

Node.js Version

20.18.2

How did you install Ghost?

Ubuntu 20.04.6 LTS

Database type

MySQL 8

Browser & OS version

No response

Relevant log / error output

Code of Conduct

  • I agree to be friendly and polite to people in this repository
@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label Feb 6, 2025
@mike182uk
Copy link
Member

Thanks for reporting this @flavianh

This looks to be a bug with the staleWhileRevalidate option does not actually get used in the frontend caching middleware, which is why you are not seeing the header get set

@mike182uk mike182uk added P3 - Medium [triage] Bugs which we'll fix soon and removed needs:triage [triage] this needs to be triaged by the Ghost team labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 - Medium [triage] Bugs which we'll fix soon
Projects
None yet
Development

No branches or pull requests

2 participants