Repository: caddyserver/caddy (language: go)

Issue:
Cookie Placeholder
Here is the documentation for placeholders. 
https://caddyserver.com/docs/caddyfile/concepts#placeholders

In caddy 1, we could do {~cookie-name}
In caddy 2 the docs mention
{header.*} | {http.request.header.*}
Not quite clear how to index into the specific cookie. 
I did see one recent posting using the  {~cookie-name} approach, so I am going to try that, but clearer documentation would be helpful for those of us who are new to this. 

Thanks
Chris
 





Discussion / hints:
The template docs also mention. 
// {{.Cookie "cookiename"}}

Maybe the following will work:
{.Cookie "cookiename"}
But again it would be good if it were in the placeholder docs. 
You opened lucky issue number #5000! 🎉

You can use the placeholder `{http.request.cookie.*}` where `*` is the cookie name.

You're right that we're missing a Caddyfile shortcut for that though, we should add that. It'll be `{cookie.*}`

Fix patch:
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index cca864d0683..8fef131bf79 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -91,10 +91,11 @@ func (st ServerType) Setup(inputServerBlocks []caddyfile.ServerBlock,
 		search  *regexp.Regexp
 		replace string
 	}{
-		{regexp.MustCompile(`{query\.([\w-]*)}`), "{http.request.uri.query.$1}"},
-		{regexp.MustCompile(`{labels\.([\w-]*)}`), "{http.request.host.labels.$1}"},
 		{regexp.MustCompile(`{header\.([\w-]*)}`), "{http.request.header.$1}"},
+		{regexp.MustCompile(`{cookie\.([\w-]*)}`), "{http.request.cookie.$1}"},
+		{regexp.MustCompile(`{labels\.([\w-]*)}`), "{http.request.host.labels.$1}"},
 		{regexp.MustCompile(`{path\.([\w-]*)}`), "{http.request.uri.path.$1}"},
+		{regexp.MustCompile(`{query\.([\w-]*)}`), "{http.request.uri.query.$1}"},
 		{regexp.MustCompile(`{re\.([\w-]*)\.([\w-]*)}`), "{http.regexp.$1.$2}"},
 		{regexp.MustCompile(`{vars\.([\w-]*)}`), "{http.vars.$1}"},
 		{regexp.MustCompile(`{rp\.([\w-\.]*)}`), "{http.reverse_proxy.$1}"},


Test patch: