I'm trying to get Caddy server to display a file that is kind of dynamic (assigned to a variable). I find the official documentation a bit opaque and searching Internets doesn't return much info either.
My example Caddyfile
config:
example.com {
route / {
# own plugin that adds custom headers to the request
my_plugin do_something
map {header.something} {my_file} {
x "x.html"
y "y.html"
default "404.html"
}
file_server {
browse {my_file}
}
}
}
So the idea is Caddy displays "y.html" template if the request contains "something" with value "y". You get the picture.
However Caddy will complain with:
http.log.error parsing browse template: parsing browse template file: open {my_file}: no such file or directory
Looks like it takes the "{my_file}" in literal matters(!).
How does one gets this done in Caddy?
N.B
Other examples such as redir {my_file}
work and redirect to "example.com/y.html".
Or is there better way in general to display a template "from a variable" ?
templates {my_file}
does not work.