Fix wrong last modify time (#32102)

(cherry picked from commit a802508f88e546bf18990559e44bf27a09c869ee)
This commit is contained in:
Lunny Xiao 2024-09-22 05:56:25 +08:00 committed by Earl Warren
parent 2675a24649
commit f709de2403
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 8 additions and 3 deletions

View file

@ -79,6 +79,7 @@ func ServeSetHeaders(w http.ResponseWriter, opts *ServeHeaderOptions) {
httpcache.SetCacheControlInHeader(header, duration)
if !opts.LastModified.IsZero() {
// http.TimeFormat required a UTC time, refer to https://pkg.go.dev/net/http#TimeFormat
header.Set("Last-Modified", opts.LastModified.UTC().Format(http.TimeFormat))
}
}