How to determine if the API response was returned from the cache or backend?
Answered
Australian Freshwater Crocodile posted this in #help-forum
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
From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
next.config.js
file:module.exports = {
logging: {
fetches: {
fullUrl: true,
},
},
}
From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
2 Replies
Try adding this to your
From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
next.config.js
file:module.exports = {
logging: {
fetches: {
fullUrl: true,
},
},
}
From docs:
https://nextjs.org/docs/app/api-reference/next-config-js/logging
Answer
Australian Freshwater CrocodileOP
Thank you!!!