How to configure subpath in Caddy 2.5?

1. Caddy version (caddy version):


2. How I run Caddy:

apt package systemd

a. System environment:

Ubuntu 20.04 amd64

b. Command:

Paste command here.

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config: {
        @getwell {
                method GET
                path /.well-known/*

        tls {
                load /var/websites/certificates/wekanteam
                alpn http/1.1

        handle /.well-known/assetlinks.json {
                header Cache-Control max-age=0
                try_files {path} /var/websites/


3. The problem I’m having:

URL does not work:

4. Error messages and/or full log output:

5. What I already tried:

Updated to newest Caddy, and then this did not work anymore.

6. Links to relevant resources:

You defined this matcher, but never used it. You can remove this, I guess.

You’re using try_files and file_server without having defined a root. This means that files will get served relative to the caddy user’s HOME, which is /var/lib/caddy. That’s probably not what you want.

Try this instead:

	handle /.well-known/assetlinks.json {
		root * /var/websites/
		header Cache-Control max-age=0

Thanks! After fixing board => boards, it works now!

1 Like

Right, my bad, typed it out :stuck_out_tongue: