summaryrefslogtreecommitdiff
path: root/internal/router/router.go
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 22:37:42 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2026-05-02 22:37:42 +0700
commit78d6b00cd973e4254ea13cbb17bb35a30fef51b9 (patch)
tree4b92040c987f48b523142e0a48d5911a574f34c7 /internal/router/router.go
parent2e53d0a1c5ff42a88acbede28220010f0237e855 (diff)
downloadweb-78d6b00cd973e4254ea13cbb17bb35a30fef51b9.tar.gz
web-78d6b00cd973e4254ea13cbb17bb35a30fef51b9.zip
fix: set cache-control for non-cacheable pages
Diffstat (limited to 'internal/router/router.go')
-rw-r--r--internal/router/router.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/router/router.go b/internal/router/router.go
index 14973ad..65e35a4 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -309,6 +309,8 @@ func (r *Router) InitRoutes() (err error) {
cacheKey = fmt.Sprintf("%s.full-page.%s", method, trimmedPath)
case ByUrlAndQuery:
cacheKey = fmt.Sprintf("%s.full-page.%s.%s", method, trimmedPath, queryString)
+ case Disabled:
+ c.Set("Cache-Control", "no-store, no-cache, must-revalidate")
}
defaultMap := fiber.Map{
@@ -371,6 +373,7 @@ func (r *Router) InitRoutes() (err error) {
c.Set(fiber.HeaderContentType, fiber.MIMETextPlainCharsetUTF8)
return c.Status(fiber.ErrBadRequest.Code).SendString(fmt.Sprintf("unknown segment '%s'", part))
}
+ c.Set("Cache-Control", "no-store, no-cache, must-revalidate")
err := r.generalPageSegment(c, part)
return err
})