I have been using caddy on a ubuntu 22.04 server for a while now with no issues. Recently I have added a subdomain to my caddyfile. When I try to access that subdomain I get a 526 error of a invalid certificate page from cloudflare, which I am proxied through. The subdomain is setup just as all my other subdomains on my cloudflare DNS settings (CNAME).
If you’re proxying Caddy behind Cloudflare, then Cloudflare prevents Caddy from successfully completing ACME challenges. Your logs would show that’s the case.
Did you include that backtick character at the end? You should not. It should look like this:
$ journalctl -u caddy --no-pager | less +G
Your options are either to get a build of Caddy with the Cloudflare DNS plugin and configure Caddy with your Cloudflare API key to use the ACME DNS challenge, or you could just turn off Cloudflare proxying (i.e. orange cloud → grey cloud).