Well, putting it outside will make Caddy think it’s a site address; see The Caddyfile — Caddy Documentation for the syntax.
So inside is correct. Make sure you’ve followed all the instructions here: https://github.com/mholt/caddy/wiki/Writing-a-Plugin:-Directives