From 3996518ed432218d7f2fd62d451ee0e29953d853 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 13 Mar 2025 07:04:50 +0800 Subject: Refactor cache-control (#33861) And fix #21391 --- services/context/api.go | 2 +- services/context/context.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'services') diff --git a/services/context/api.go b/services/context/api.go index c163de036c..89280cac80 100644 --- a/services/context/api.go +++ b/services/context/api.go @@ -232,7 +232,7 @@ func APIContexter() func(http.Handler) http.Handler { } } - httpcache.SetCacheControlInHeader(ctx.Resp.Header(), 0, "no-transform") + httpcache.SetCacheControlInHeader(ctx.Resp.Header(), &httpcache.CacheControlOptions{NoTransform: true}) ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions) next.ServeHTTP(ctx.Resp, ctx.Req) diff --git a/services/context/context.go b/services/context/context.go index f3a0f0bb5f..79bc5da920 100644 --- a/services/context/context.go +++ b/services/context/context.go @@ -191,7 +191,7 @@ func Contexter() func(next http.Handler) http.Handler { } } - httpcache.SetCacheControlInHeader(ctx.Resp.Header(), 0, "no-transform") + httpcache.SetCacheControlInHeader(ctx.Resp.Header(), &httpcache.CacheControlOptions{NoTransform: true}) ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions) ctx.Data["SystemConfig"] = setting.Config() -- cgit v1.2.3