There isn’t a whole lot of documentation as far as I can tell with Caddy templates, so I want to know if it’s possible to get response code in a Caddy template. So I can for example do
{{if .responsecode eq 404}}
<p>404 not found</p>
{{end}}
Templates are run before the status code is decided, so this doesn’t quite make sense.
Unless you mean the status code from an error, inside of handle_errors, in which case you can use the placeholder function to get the value of the http.error.status_code placeholder.
Please fill out the help topic template, as per the forum rules. There’s not enough context in your question so I have to make assumptions to answer, and that wastes time for the both of us.
What’s a placeholder function? Never heard of that before. Also yeah, I should have filled the template, I’m sorry. But yes, that’s precisely what I want.