refactor: caddy config according to subject
This commit is contained in:
parent
fb2fa75f90
commit
3949c432f5
|
|
@ -5,7 +5,6 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
|
||||||
volumes:
|
volumes:
|
||||||
- caddy-caddyfiles:/etc/caddy
|
- caddy-caddyfiles:/etc/caddy
|
||||||
- caddy-data:/data
|
- caddy-data:/data
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,4 @@
|
||||||
outils.localhost {
|
{
|
||||||
local_certs
|
local_certs
|
||||||
header X-Chatons "miaou"
|
}
|
||||||
|
import /etc/caddy/sites/*.caddy
|
||||||
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 {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
27
core/caddy/config/outils.caddy
Normal file
27
core/caddy/config/outils.caddy
Normal 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/* {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
Loading…
Reference in a new issue