Anubis module for Caddy

Compare changes

Choose any two refs to compare.

Changed files
+34 -1
+33 -1
README.md
···
-
# `caddy_anubis`
+
# `caddy-anubis`
You can add caddy-anubis to your server using xcaddy:
···
--replace github.com/TecharoHQ/anubis=github.com/kotx/anubis-static@v1.23.1
# ...any other plugins
```
+
+
## Example config
+
+
```Caddyfile
+
localhost {
+
@anubis {
+
# This matcher allows you to select specific paths for Anubis to handle.
+
# If you want to handle all paths, remove this block and use `anubis {...}` instead!
+
path / # don't let AI scrapers browse the file index
+
path /.within.website/* # required for anubis to work
+
+
not path /api/* # exclude api routes from anubis
+
}
+
+
log http.handlers.anubis {
+
level DEBUG # optionally set log level
+
}
+
+
anubis @anubis {
+
# This setting gets overridden a lot by the default bot policy.
+
difficulty 4
+
+
# Custom bot policy file
+
policy_fname botPolicies.yaml
+
+
private_key {$ED25519_PRIVATE_KEY} # for challenge persistence across restarts
+
# or if you're running multiple anubis instances
+
}
+
+
file_server browse
+
}
+
```
+1
caddy_anubis.go
···
return err
}
r.Header.Set("X-Real-Ip", remoteHost)
+
r.Header.Set("X-Http-Version", r.Proto)
m.next = next
m.err = nil