diff --git a/replacer.go b/replacer.go index 817bcfe3..5d33b7f1 100644 --- a/replacer.go +++ b/replacer.go @@ -319,7 +319,10 @@ func globalDefaultReplacements(key string) (any, bool) { case "time.now": return nowFunc(), true case "time.now.http": - return nowFunc().Format(http.TimeFormat), true + // According to the comment for http.TimeFormat, the timezone must be in UTC + // to generate the correct format. + // https://github.com/caddyserver/caddy/issues/5773 + return nowFunc().UTC().Format(http.TimeFormat), true case "time.now.common_log": return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true case "time.now.year":