Configuring Cache
EdgeOne Pages uses edge networks to cache your static resource content worldwide, which is closer to users than storing on the origin server. This can reduce server load and improve website performance, thereby increasing your website's access speed.
Browser Cache
To provide your users with a high-quality access experience, Pages applies differentiated handling to the browser cache policy for static files:
Files with hash (e.g., main.a1b2c3.js): Set max-age=31536000 (one year) to achieve long-term caching.
Files without hash (e.g., index.html): Set max-age=0 to ensure content freshness.
The default rule of Pages can be overwritten by the headers configuration in edgeone.json. For the specific method, refer to the document edgeone.json - headers.
Edge Cache
Pages' default settings are optimized for edge caching of static resources. These resources are cached on EdgeOne nodes after the first request, with a maximum cache time of three months. Meanwhile, edge cache is automatically invalidated after each new deployment, ensuring users always retrieve the latest content. Therefore, in most cases, you should avoid setting caching logic for static resources on EdgeOne nodes.
You can also configure edge cache time for different resources based on business needs, optimize edge cache policies, and enhance the loading speed of requested resources. For the specific configuration method, refer to the document edgeone.json - caches.
Warning:
As long as a project triggers a new deployment, the edge cache will still be automatically invalidated to ensure users can access the latest content.
