Hi.
Today I used the https://caddyserver.com/docs/templates and wanted to print all Headers but there isn’t such a function like .Env
{{range $field, $val := .Env}}
{{$field}}: {{$val}}
{{end}}
Is there any plan to add this?
br aleks
Hi.
Today I used the https://caddyserver.com/docs/templates and wanted to print all Headers but there isn’t such a function like .Env
{{range $field, $val := .Env}}
{{$field}}: {{$val}}
{{end}}
Is there any plan to add this?
br aleks
Hey Aleks, good question. There’s an example on the template actions page:
{{range $field, $val := .Req.Header}}
{{$field}}: {{$val}}
{{end}}
That should do something like what you want!
I could probably expand those docs a bit. Will note that for the future.
Thanks matt.
sorry for the rush. I have read this jus before I got to bed ;-/
Please accept my apologize for the useless question.
facepalm
and wit works
https://caddy-template-usage-1-caddy-teplate.playground.itandtel.at/templates/print-headers.tmpl
The used dockerfile and templates are at this repo
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.