From f5a13a4ab4e1dd1066fa81fb044127ae18c4f001 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 27 Mar 2023 16:51:13 -0400 Subject: [PATCH] replacer: Add HTTP time format (#5458) --- replacer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/replacer.go b/replacer.go index 7f97f3472..16d50ac2a 100644 --- a/replacer.go +++ b/replacer.go @@ -16,6 +16,7 @@ package caddy import ( "fmt" + "net/http" "os" "path/filepath" "runtime" @@ -316,6 +317,8 @@ func globalDefaultReplacements(key string) (any, bool) { return runtime.GOARCH, true case "time.now": return nowFunc(), true + case "time.now.http": + return nowFunc().Format(http.TimeFormat), true case "time.now.common_log": return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true case "time.now.year":