Why CF doesn't cache this worker?

Can someone help me figure out why this worker never gets cached:

https://oparse.com/api/cache

The response correctly sets cache-control max-age=60, stale-while-revalidate=60 (you can see it in the browser inspector)

Yet from both logs ad DR flare extension I can see the response is never cached. What am I doing wrong?

The worker is:

export default defineEventHandler(async (event) => {
  const now = Date.now()
  const cacheHeaders = "max-age=60, stale-while-revalidate=60"
  setResponseHeader(event, "Cache-Control", cacheHeaders)
  return `Timestamp is: ${now}`
})
Was this page helpful?