aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorYarden Shoham2023-03-08 22:40:04 +0200
committerGitHub2023-03-08 15:40:04 -0500
commitaf0468ed8dea62f373c51efaa679080a9cb69f5c (patch)
tree872b1ecb010503d74236c04e95aa78badba5d9d4 /routers
parent1960ad5c90df65100488b64e7047d1ba3096c11c (diff)
Set `X-Gitea-Debug` header once (#23361)
Instead of adding it # Before On the raw commit page: ![image](https://user-images.githubusercontent.com/20454870/223470744-cdf11898-e023-4198-8c8b-c294e5d78b73.png) # After ![image](https://user-images.githubusercontent.com/20454870/223470596-af898d66-bd5b-4ddb-b220-ceb1f149bfec.png) Fixes #23308 --------- Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/install/routes.go2
-rw-r--r--routers/web/base.go2
-rw-r--r--routers/web/user/avatar.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/routers/install/routes.go b/routers/install/routes.go
index a8efc92fe..82d9c34b4 100644
--- a/routers/install/routes.go
+++ b/routers/install/routes.go
@@ -64,7 +64,7 @@ func installRecovery(ctx goctx.Context) func(next http.Handler) http.Handler {
"SignedUserName": "",
}
- httpcache.AddCacheControlToHeader(w.Header(), 0, "no-transform")
+ httpcache.SetCacheControlInHeader(w.Header(), 0, "no-transform")
w.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
if !setting.IsProd {
diff --git a/routers/web/base.go b/routers/web/base.go
index d0135eac7..2eb0b6f39 100644
--- a/routers/web/base.go
+++ b/routers/web/base.go
@@ -159,7 +159,7 @@ func Recovery(ctx goctx.Context) func(next http.Handler) http.Handler {
store["SignedUserName"] = ""
}
- httpcache.AddCacheControlToHeader(w.Header(), 0, "no-transform")
+ httpcache.SetCacheControlInHeader(w.Header(), 0, "no-transform")
w.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
if !setting.IsProd {
diff --git a/routers/web/user/avatar.go b/routers/web/user/avatar.go
index 2dba74822..7ad65cd51 100644
--- a/routers/web/user/avatar.go
+++ b/routers/web/user/avatar.go
@@ -17,7 +17,7 @@ func cacheableRedirect(ctx *context.Context, location string) {
// here we should not use `setting.StaticCacheTime`, it is pretty long (default: 6 hours)
// we must make sure the redirection cache time is short enough, otherwise a user won't see the updated avatar in 6 hours
// it's OK to make the cache time short, it is only a redirection, and doesn't cost much to make a new request
- httpcache.AddCacheControlToHeader(ctx.Resp.Header(), 5*time.Minute)
+ httpcache.SetCacheControlInHeader(ctx.Resp.Header(), 5*time.Minute)
ctx.Redirect(location)
}