Disable CDN caching for HTML, add Quicklink prefetching
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
- Change Cache-Control from s-maxage=31536000 to max-age=0,must-revalidate for all HTML pages and sitemap (fixes stale content after settings change) - Remove Cloudflare PurgeURLs call since we're not caching HTML at CDN - Add Quicklink for client-side prefetching on public blog pages - Make main branch deploy automatic (remove manual trigger) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5329167c8c
commit
c662e41b97
4 changed files with 9 additions and 18 deletions
|
|
@ -98,7 +98,7 @@ func (s *Server) blogHome(w http.ResponseWriter, r *http.Request) {
|
|||
s.recordPageView(q, r, "/", "")
|
||||
|
||||
if html, etag, err := q.GetPage(r.Context(), "/"); err == nil && html != nil {
|
||||
s.servePreRendered(w, r, html, etag, "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, etag, "public, max-age=0, must-revalidate")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ func (s *Server) blogHome(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, max-age=0, must-revalidate")
|
||||
}
|
||||
|
||||
func (s *Server) blogList(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -172,7 +172,7 @@ func (s *Server) blogList(w http.ResponseWriter, r *http.Request) {
|
|||
s.recordPageView(q, r, "/posts", "")
|
||||
|
||||
if html, etag, err := q.GetPage(r.Context(), "/posts"); err == nil && html != nil {
|
||||
s.servePreRendered(w, r, html, etag, "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, etag, "public, max-age=0, must-revalidate")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ func (s *Server) blogList(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, max-age=0, must-revalidate")
|
||||
}
|
||||
|
||||
func (s *Server) blogPost(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -249,7 +249,7 @@ func (s *Server) blogPost(w http.ResponseWriter, r *http.Request) {
|
|||
s.recordPageView(q, r, path, slug)
|
||||
|
||||
if html, etag, err := q.GetPage(r.Context(), path); err == nil && html != nil {
|
||||
s.servePreRendered(w, r, html, etag, "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, etag, "public, max-age=0, must-revalidate")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -457,7 +457,7 @@ func (s *Server) blogPost(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, s-maxage=31536000, max-age=0")
|
||||
s.servePreRendered(w, r, html, computeETag(html), "public, max-age=0, must-revalidate")
|
||||
}
|
||||
|
||||
func (s *Server) canPreview(r *http.Request, tenantID string) bool {
|
||||
|
|
@ -543,7 +543,7 @@ func (s *Server) sitemap(w http.ResponseWriter, r *http.Request) {
|
|||
baseURL := getBaseURL(r.Host)
|
||||
|
||||
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
||||
w.Header().Set("Cache-Control", "public, s-maxage=31536000, max-age=0")
|
||||
w.Header().Set("Cache-Control", "public, max-age=0, must-revalidate")
|
||||
|
||||
w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue