refactor: caddy config according to subject

This commit is contained in:
Haletran 2026-02-21 18:23:26 +01:00
parent fb2fa75f90
commit 3949c432f5
4 changed files with 30 additions and 26 deletions

View file

@ -5,7 +5,6 @@ services:
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- caddy-caddyfiles:/etc/caddy
- caddy-data:/data

View file

@ -1,25 +1,4 @@
outils.localhost {
{
local_certs
header X-Chatons "miaou"
respond /healthcheck "OK"
#handle_path or handle are the same except you need to prefix things instead of already having it uri strip_prefix /prefix
handle_path /hello/* {
respond "Hello {path.0}!"
close
}
handle /date {
respond "{http.date} {http.time}"
close
}
handle /ip {
respond {{.ClientIP}}
}
handle_path /b64/encode {
}
handle_path /b64/decode {
}
}
}
import /etc/caddy/sites/*.caddy

View file

@ -0,0 +1,27 @@
http://outils.localhost {
header X-Chatons "miaou"
respond /healthcheck "OK"
redir / /hello/world
redir /hello /hello/world
handle_path /hello/* {
respond "Hello {path.0}!"
}
handle /date {
templates
respond `{{now | date "2006-01-02 15:04:05"}}`
}
handle /ip {
respond "{{.ClientIP}"
}
handle_path /b64/encode/* {
}
handle_path /b64/decode/* {
}
}

View file

@ -1 +0,0 @@
#!/usr/bin/env bash