aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-03-13 07:04:50 +0800
committerGitHub <noreply@github.com>2025-03-13 07:04:50 +0800
commit3996518ed432218d7f2fd62d451ee0e29953d853 (patch)
tree9a3ef66b10e40eeee72c7a63b57f6153eee8a0ac /services
parent91610a987e4c805a9305d4ee951963f80dbeb9ee (diff)
downloadgitea-3996518ed432218d7f2fd62d451ee0e29953d853.tar.gz
gitea-3996518ed432218d7f2fd62d451ee0e29953d853.zip
Refactor cache-control (#33861)
And fix #21391
Diffstat (limited to 'services')
-rw-r--r--services/context/api.go2
-rw-r--r--services/context/context.go2
2 files changed, 2 insertions, 2 deletions
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()