Skip to content

HTTP Basic Authentication

jpduyx edited this page Feb 13, 2024 · 2 revisions

HTTP Basic Authentication can be created like this:

caddy.basicauth: /secret/*
caddy.basicauth.Bob: $$2a$$14$$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
↓
basicauth /secret/* {
	Bob $2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG
}

Protects all resources in /secret so only Bob can access them with the password "hiccup".

NOTE in docker-compose.yml you should escape the $ in the password with $$ double dollar

Clone this wiki locally