mirror of https://github.com/Xhofe/alist
fix: disable cache for 302 redirect (close #2216)
parent
f0a533a77a
commit
18cd45d257
|
@ -37,6 +37,7 @@ func Down(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Header("Referrer-Policy", "no-referrer")
|
c.Header("Referrer-Policy", "no-referrer")
|
||||||
|
c.Header("Cache-Control", "max-age=0, no-cache, no-store, must-revalidate")
|
||||||
c.Redirect(302, link.URL)
|
c.Redirect(302, link.URL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,7 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
|
||||||
common.GetApiUrl(r),
|
common.GetApiUrl(r),
|
||||||
utils.EncodePath(reqPath, true),
|
utils.EncodePath(reqPath, true),
|
||||||
sign.Sign(path.Base(reqPath)))
|
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)
|
http.Redirect(w, r, u, 302)
|
||||||
} else {
|
} else {
|
||||||
link, _, err := fs.Link(ctx, reqPath, model.LinkArgs{IP: utils.ClientIP(r)})
|
link, _, err := fs.Link(ctx, reqPath, model.LinkArgs{IP: utils.ClientIP(r)})
|
||||||
|
|
Loading…
Reference in New Issue