mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 05:33:49 +03:00
replacer: change timezone to UTC for "time.now.http" placeholders (#5774)
This commit is contained in:
parent
38a7b6b3d0
commit
4776f62caa
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue