Skip to content

Commit

Permalink
fix: disable cache for 302 redirect (close #2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 5, 2022
1 parent f0a533a commit 18cd45d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/handles/down.go
Expand Up @@ -37,6 +37,7 @@ func Down(c *gin.Context) {
return
}
c.Header("Referrer-Policy", "no-referrer")
c.Header("Cache-Control", "max-age=0, no-cache, no-store, must-revalidate")
c.Redirect(302, link.URL)
}
}
Expand Down
1 change: 1 addition & 0 deletions server/webdav/webdav.go
Expand Up @@ -232,6 +232,7 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
common.GetApiUrl(r),
utils.EncodePath(reqPath, true),
sign.Sign(path.Base(reqPath)))
w.Header().Set("Cache-Control", "max-age=0, no-cache, no-store, must-revalidate")
http.Redirect(w, r, u, 302)
} else {
link, _, err := fs.Link(ctx, reqPath, model.LinkArgs{IP: utils.ClientIP(r)})
Expand Down

0 comments on commit 18cd45d

Please sign in to comment.