Skip to content
Dr. Thomas Jansen edited this page Aug 9, 2023 · 2 revisions

Preventing Git repository exposure in Caddy

If you are using Caddy web server, add the following directive to your Caddyfile file:

respond /.git* 403

If you want to return a 404 HTTP status code instead of 403, use the following instead:

respond /.git* 404

Don't forget to restart Caddy after making the change, e.g. on Debian:

sudo systemctl restart caddy
Clone this wiki locally