From c3c9e3d08dbc7a8fbe0abd75e53a41623649e577 Mon Sep 17 00:00:00 2001 From: Daniele Tonon Date: Wed, 20 Dec 2023 07:49:03 +0100 Subject: [PATCH] Set cache-control for profiles and related sitemap/rss --- render_profile.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/render_profile.go b/render_profile.go index 4ef771c..b383002 100644 --- a/render_profile.go +++ b/render_profile.go @@ -41,6 +41,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) { if isSitemap { w.Header().Add("content-type", "text/xml") + w.Header().Set("Cache-Control", "max-age=86400") w.Write([]byte(XML_HEADER)) SitemapTemplate.Render(w, &SitemapPage{ Host: s.Domain, @@ -50,6 +51,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) { }) } else if isRSS { w.Header().Add("content-type", "text/xml") + w.Header().Set("Cache-Control", "max-age=86400") w.Write([]byte(XML_HEADER)) RSSTemplate.Render(w, &RSSPage{ Host: s.Domain, @@ -60,6 +62,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) { }) } else { w.Header().Add("content-type", "text/html") + w.Header().Set("Cache-Control", "max-age=86400") err = ProfileTemplate.Render(w, &ProfilePage{ HeadCommonPartial: HeadCommonPartial{IsProfile: true, TailwindDebugStuff: tailwindDebugStuff}, DetailsPartial: DetailsPartial{