How to add Cache-Control header to static pages .json data?
Unanswered
Pachon Navarro posted this in #help-forum
Pachon NavarroOP
Hello,
I would like to know if it's possible to add a HTTP cache header to the .json request of a statically generated page.
As you can see in the image, if I reload the page it fetches the .json AGAIN (it's already quite heavy I know it's not super ideal but caching it would be a quick solution to fix this temporarily until I come up with better solutions)
I'm using
Thanks for any guidance/help!
I would like to know if it's possible to add a HTTP cache header to the .json request of a statically generated page.
As you can see in the image, if I reload the page it fetches the .json AGAIN (it's already quite heavy I know it's not super ideal but caching it would be a quick solution to fix this temporarily until I come up with better solutions)
I'm using
/pages directory with getStaticProps with no revalidate option.Thanks for any guidance/help!
2 Replies
@joulev Set the header in middleware
Pachon NavarroOP
Thank you! I will try that