Skip to content

Commit 7761729

Browse files
authored
Merge pull request #1057 from DuendeSoftware/mb/cache
Add caching for Pagefind assets with 1-hour max-age
2 parents b635889 + 5a9117b commit 7761729

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

server/src/Docs.Web/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@
9494
var path = ctx.File.Name;
9595
var requestPath = ctx.Context.Request.Path.Value ?? "";
9696

97+
// Pagefind assets (pagefind folder) - cache for 1 hour
98+
if (requestPath.Contains("/pagefind/"))
99+
{
100+
ctx.Context.Response.Headers.CacheControl = "public, max-age=3600";
101+
return;
102+
}
103+
97104
// Astro assets (_astro folder) - cache for 1 year
98105
if (requestPath.Contains("/_astro/"))
99106
{

0 commit comments

Comments
 (0)