I noticed singularity in settings Caddyfile

Hey!
I noticed singularity in settings Caddyfile.

When I write this syntax - everything is working:
localhost:8080 {
root /Users/root/workflow/site
}

if I write this syntax:
localhost:8080 {
root ~/workflow/site
}

I get 404 error.
Why not use an alias?
Because such a desire can appear not only for me. And this is not described in the docs and could complicate the search for errors.
Thanks for reading =)

Simple: ~ is a bash expansion, it has nothing to do with Caddy.

You could use {$HOME} instead, since this is how Caddy parses env variables in the Caddyfile, but it is not bash, so tilde won’t be replaced with your home folder.

3 Likes

Thank you Matt. I will be know :smile:

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