Setting Cache-Control Headers
Through HTTP, Cache-Control
gives your frontend applications instructions for caching requests and responses to your app. Optimizing Cache-Control for our Headless Platform will help with the deliverability of your content between the frontend and WordPress backends. To determine how to set up Cache-Control, see the MDN Web documentation for Cache-Control.
Apps Without Cache-Control
When you choose not to use Cache-Control, our Headless Platform attempts to guess how to cache content based on the MIME type. Static resources, such as CSS, Javascript, JSON, images, and videos, cache usually for 10 seconds.
Next.js Apps
Frontend applications using Next.js add immutable Cache-Control header resources, with max-age
being when a resource remains in the cache in seconds. For example, any resources found in /_next/static/
stay cached for max-age=31536000,immutable
. Other static resources such as /public/images/
stay cached for max-age=0
.
For any custom resources you want to cache, add your custom headers outside of /_next/static/
. For instructions, refer to the Next.jsâ headers documentation.