Next.js Discord

Discord Forum

How to determine if the API response was returned from the cache or backend?

Answered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Avatar
Australian Freshwater CrocodileOP
Hey guys, I'm playing around with how data fetching works in Next.js and I want to determine if the API response was returned from the cache or backend, is there a way to do so? Maybe there is some internal property in the API response or something?
Answered by jason
Try adding this to your next.config.js file:

module.exports = {
  logging: {
    fetches: {
      fullUrl: true,
    },
  },
}


From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
View full answer

2 Replies

Avatar
Try adding this to your next.config.js file:

module.exports = {
  logging: {
    fetches: {
      fullUrl: true,
    },
  },
}


From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
Answer
Avatar
Australian Freshwater CrocodileOP
Thank you!!!