-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
- Loading branch information
1 parent
eb6934f
commit 0ecb1ba
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Configure Caddy | ||
POST http://localhost:2019/load | ||
Content-Type: text/caddyfile | ||
``` | ||
{ | ||
skip_install_trust | ||
http_port 9080 | ||
https_port 9443 | ||
local_certs | ||
debug | ||
} | ||
localhost { | ||
log | ||
basic_auth { | ||
john $2a$14$x4HlYwA9Zeer4RkMEYbUzug9XxWmncneR.dcMs.UjalR95URnHg5. | ||
} | ||
respond "Hello, World!" | ||
} | ||
``` | ||
|
||
# requests without `Authorization` header are rejected with 401 | ||
GET https://localhost:9443 | ||
[Options] | ||
insecure: true | ||
HTTP 401 | ||
[Asserts] | ||
header "WWW-Authenticate" == "Basic realm=\"restricted\"" | ||
|
||
|
||
# requests with `Authorization` header are accepted with 200 | ||
GET https://localhost:9443 | ||
[BasicAuth] | ||
john:password | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
`Hello, World!` |