Sodki
(Henrique Rodrigues)
1
Hi, I don’t think I’m fully grasping the concept of templates in Caddy yet. I have extensive experience with templates generally.
Question 1: Is it possible to combine “templates” and “static_response”?
Question 2: is it possible to have inline templates instead of having them in a separate file?
Ideally I would like to have a simple “hello world” type example where the “hello world” text came from a simple inline template.
Thank you
matt
(Matt Holt)
2
Yes! The static response can consist of a template string which will then be evaluated.
I believe so:
Don’t forget to set the right Content-Type of your static response.
Caddyfile example:
:80 {
templates
respond `This is a template: {{ placeholder "system.hostname" }}`
}
$ curl http://localhost
This is a template: francis-laptop
Sodki
(Henrique Rodrigues)
4
Thank you all so much, I’ve managed to do a simple PoC that shows that what I want to do is possible. Kudos!
2 Likes
system
(system)
Closed
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.