Hello Team,
As I am exploring the capabilities of EDS, want to understand the controlling the cache for pages on EDS.
Tried couple of methods such are having .helix/headers with cache-control header in google drive and following another step of having configuration helix-routes.yaml file in git repo.
Both approach dint work for me. Please guide me.
해결되었습니다! 솔루션으로 이동.
토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.
조회 수
답글
좋아요 수
Hi @PradeepMC1 ,
You can control caching of pages by cache-control header for a cacheable page:
Cache-Control: public, max-age=3600, stale-while-revalidate=60
public
: Indicates that the response can be cached by any cache, including browsers and CDNs.max-age=3600
: Sets the cache duration to one hour.stale-while-revalidate=60
: Allows serving stale content for up to 60 seconds while fetching fresh content in the background.
-Tarun
Hi @PradeepMC1 ,
Pls Follow Below Steps to Control Cache in EDS:
Step 1: Identify Your Project Type
Are you using:
- Google Drive/OneDrive ➜ Use .helix/headers file
- GitHub Repo ➜ Use helix-routes.yaml file
Step 2: For Google Drive/OneDrive Projects
- Create a file named .helix/headers in your drive.
- Add below lines to control caching for your pages:
/path/to/page.html
Cache-Control: public, max-age=3600, stale-while-revalidate=60
- This sets:
- Cache duration = 1 hour (3600 seconds)
- Allows stale content for 60 seconds during revalidation
Step 3: For GitHub Repo Projects
- Open your GitHub repo.
- Create or update helix-routes.yaml in root.
- Add this configuration:
version: 1
static:
- path: "/**"
headers:
cache-control: "public, max-age=3600, stale-while-revalidate=60"
- This applies cache to all pages. Modify path as needed (/about.html, /blog/**, etc.)
Step 4: Validate Cache Header is Applied
- Deploy your site (EDS).
- Open site in browser ➜ DevTools (F12) ➜ Network tab.
- Select a page ➜ Check Response Headers.
You should see:
Cache-Control: public, max-age=3600, stale-while-revalidate=60
Step 5: No Cache (Optional)
If you don’t want any caching, use this instead:
Cache-Control: no-cache, no-store, must-revalidate
Regards,
Amit
조회 수
답글
좋아요 수
Could you please share reference document for helix-routes.yaml file, I have not able to find anything on adobe doc ?
Step 3: For GitHub Repo Projects
- Open your GitHub repo.
- Create or update helix-routes.yaml in root.
조회 수
Likes
답글
조회 수
Like
답글