mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 11:00:53 +08:00
replacer: change timezone to UTC for "time.now.http" placeholders (#5774)
This commit is contained in:
parent
38a7b6b3d0
commit
4776f62caa
|
@ -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":
|
||||
|
|
Loading…
Reference in New Issue
Block a user