I'm trying to do something which seems fairly trivial to me, but can't seem to get it right with Caddy.
I have the following site configured with Caddy:
foo.com {
tls {
dns cloudflare ...
}
reverse_proxy /* http://proxy-foo
}
I'm now trying to enable a maintenance page, such that all requests serve the maintenance html, and return a 503 status code. But, I can either serve the page, or the status code, but not both.
I first tried the handle_errors
directive, with a respond directive
foo.com {
tls {
dns cloudflare ...
}
# reverse_proxy /* http://proxy-foo
handle_errors {
rewrite * /503.html
file_server
}
respond * 503
}
only to later read the caveat that respond doesn't trigger the error handlers.
Also tried removing all other directives, thinking that would trigger a 404, which would in turn call the handle_errors block, but that too doesn't work. It just ends up returning 200, but with no body.
Any pointers as to where I'm going wrong much appreciated.