The idea within this thread is also great for those of us running caddy as a reverse proxy, be that in standalone application or using Cloudflare Tunnels.
discourse.example.org {
reverse_proxy <host | ip>:port
handle_errors 5xx {
root * /path/to/error-pages
rewrite * /error.html
file_server {
status 404
}
}
}
The status 404
section is important only if using Cloudflare Tunnels. If caddy returns 5xx to Cloudflare, Cloudflare Tunnel will display its own disconnect error. Changing the status indicates to Cloudflare there is a valid live connection that will serve an error page.