Templates don't work on custom error page?

I’m running Caddy 0.10.14 on Ubuntu 18.04. I have a Caddyfile like:

www.example.com {
  root /var/www/html
  log /var/log/access.log
  errors /var/log/error.log {
    * error.html

I’ve noticed that templates work throughout the site, but not on the custom error page at error.html. For instance, the example:

Welcome {{.IP}}! You're visiting {{.URI}}.

… does not work on the custom error page. Instead it displays the literal strings (like “{{.IP}}”) on the page. The same example works elsewhere on the same site.

Is this a known limitation? Or a bug?

I’ve read both https://caddyserver.com/docs/errors and https://caddyserver.com/docs/templates and can’t make sense of the behavior. Thanks.

Nope, just like the docs say:

file is the static HTML file of the error page (path is relative to site root).

So, it’s a static file. :slight_smile:

1 Like

Ah… I missed the “static” part for sure. Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.