Cache control is no-store but vercel cache is a HIT?
Answered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hi all, I have an api that gives me a presigned url to an AWS s3 resource. But the url seems to have the same expiry date regardless of when I call the endpoint. Vercel's x-vercel-cache:
has a value of HIT so the only thing I can think of is that it's a caching issue. I've tried setting Cache-Control to no-save but doesn't seem to make a difference. Not sure where to from here.
has a value of HIT so the only thing I can think of is that it's a caching issue. I've tried setting Cache-Control to no-save but doesn't seem to make a difference. Not sure where to from here.
Answered by Plague
This was changed in Next.js 15 to no longer be cached by default which is nice
16 Replies
Is your API a Next.js Route Handler?
@Plague Is your API a Next.js Route Handler?
Transvaal lionOP
I don't think so. It's a GET fiction in a route.ts file
@Transvaal lion I don't think so. It's a GET fiction in a route.ts file
Yes route.ts files are Route Handlers. Also you don’t need to check the req method being a GET that’s what the GET function is for.
Very important now, what version of next.js are you using
Very important now, what version of next.js are you using
Transvaal lionOP
Sorry! let me check
@Transvaal lion Looks like version 14
Yeah so in Next.js version 14
Regardless, you can try using the [Route Segment Config Options](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic) to force the Route Handler to be dynamic
GET Route Handlers are cached by default however, I don't think that is supposed to be the case when accessing the request object.Regardless, you can try using the [Route Segment Config Options](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic) to force the Route Handler to be dynamic
export const dynamic = 'force-dynamic'This was changed in Next.js 15 to no longer be cached by default which is nice
Answer
Transvaal lionOP
Worked, thank you!
@Transvaal lion Worked, thank you!
No problem, make sure to more my previous message as solution so this post is answered
Transvaal lionOP
I tried but no option could not find an option for it
@Transvaal lion I tried but no option could not find an option for it
That's weird it should be
/Mark Solution or something similar@Transvaal lion I tried but no option could not find an option for it
Ah okay found it, you have to right click on the message > apps > Mark Solution
I swear it was a slash command before but I could be wrong