try_files is a rewriter that runs before handlers in Caddy's directive order, rewriting /health to /index.html before handle /health matches. Wrapping try_files + file_server in a catch-all handle block makes it mutually exclusive with handle /health.
14 lines
173 B
Caddyfile
14 lines
173 B
Caddyfile
:80 {
|
|
root * /srv
|
|
encode gzip
|
|
|
|
handle /health {
|
|
respond "ok" 200
|
|
}
|
|
|
|
handle {
|
|
try_files {path} {path}/index.html {path}/ /index.html
|
|
file_server
|
|
}
|
|
}
|