diff options
| author | WeidiDeng <weidi_deng@icloud.com> | 2023-08-22 14:41:25 +0800 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-22 02:41:25 -0400 | 
| commit | 4776f62caa36c580d24be8e55ebc6a61ae129f51 (patch) | |
| tree | aa2293ac46cd6bfe967aa5ff4b9a91bf308fc997 /replacer.go | |
| parent | 38a7b6b3d0e1150bc22e2f5409b74821132f8741 (diff) | |
replacer: change timezone to UTC for "time.now.http" placeholders (#5774)
Diffstat (limited to 'replacer.go')
| -rw-r--r-- | replacer.go | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/replacer.go b/replacer.go index 817bcfe..5d33b7f 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": | 
