I’m working on a Nuxt 3 project where I've implemented some server APIs that return ETag headers. Locally, everything works perfectly in both build and dev environments, with the ETag being consistently returned. However, after deploying to Vercel, I've noticed that some APIs return the ETag header, while others do not. For instance, the /api/wt on my website www.leoon.cn returns the ETag, but other api do not. I’ve observed that the x-vercel-cache header shows a difference between hit and miss.
I’m not sure how to address this issue. My goal is to have all APIs return the ETag header so that I can manage caching based on the ETag, rather than leaving it up to Vercel. Could you please advise me on how to ensure consistent ETag header returns for all my APIs?
// Here's how I set up the etagimport type { EventHandler, EventHandlerRequest } from 'h3'Preformatted textexport const defineWrappedResponseHandler = <T extends EventHandlerRequest, D>( handler: EventHandler<T, D>): EventHandler<T, D> => defineEventHandler<T>(async event => { try { const requestETag = getHeader(event, 'if-none-match') const response = await handler(event) const resJson = JSON.stringify(response); const etag = generateETag(resJson); setHeader(event, 'ETag', etag); if (requestETag && requestETag === etag) { event.node.res.statusCode = 304; event.node.res.end(); return; } return response } catch (err) { return { err } } })this api returns the etag

this api not


