Skip to content
Discussion options

You must be logged in to vote

By default, getServerSideProps shouldn’t cache responses on the server each request should run the function anew. However, caching can happen at a few layers:
• CDN / edge caching: If you’re deploying on Vercel, the edge network might cache some responses unless you set proper headers.
• Browser caching: Make sure your response headers don’t allow client caching if you want fresh data every time.

If you want to enforce fresh data, you can set cache headers in your response, for example:

export async function getServerSideProps({ res }) {
  res.setHeader('Cache-Control', 'no-store');
  // fetch your data
  return { props: { /* data */ } };

}

This ensures that every request fetches fresh d…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@icyJoseph
Comment options

@sinavm
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by software-based-boy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants