Basic Auth

docker run -it --rm caddy caddy hash-password

This will produce the hashed password for inclusion in the caddyfile:

Create a section like so - the basicauth section goes above the reverse_proxy setion

my.example.com {

    basicauth {
        admin $2a$14$PxkRkuIvSJUgszoj5Gzhq.aqjr36T2fIzCkcunjgmQ1AI0D44Jc8G
    }

    reverse_proxy 127.0.0.1:8080
}

AuthP

authp is a Caddy Authentication Portal plugin.

Caddy Defender

Caddy Defender is a plugin for Caddy that allows you to block requests from scrapers and bots.

If running caddy via docker, swap the image URL to ghcr.io/jasonlovesdoggo/caddy-defender:latest.

also see Anubis

Logging in Caddy

Use log directive in Caddyfile within a site.

beta.jamesravey.me {
   root * /path/to/brainsteam/_site
   file_server
   log {
       output file /var/log/caddy/brainsteam-access.log {
           roll_size 2M
           roll_keep 10
       }
   }
   #reverse_proxy localhost:12380
}