From 9d3b3b7940b69b02a216c2de7efe9d7bffe29ec4 Mon Sep 17 00:00:00 2001 From: Kulvir Singh Date: Wed, 15 Oct 2025 02:35:39 +0530 Subject: [PATCH] handling errors --- caddy/error.html | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ caddy/readme.md | 7 ++++ 2 files changed, 98 insertions(+) create mode 100644 caddy/error.html diff --git a/caddy/error.html b/caddy/error.html new file mode 100644 index 0000000..68bff2c --- /dev/null +++ b/caddy/error.html @@ -0,0 +1,91 @@ + + + + + + Caddy Error + + + + +
+
{{ph "http.error.status_code"}}
+

{{ph "http.error.text"}}

+ Go Home +
+ + diff --git a/caddy/readme.md b/caddy/readme.md index bf4ac7c..5614851 100644 --- a/caddy/readme.md +++ b/caddy/readme.md @@ -52,3 +52,10 @@ Place all other config files inside `/etc/caddy/conf.d/` directory and import Ca ```Caddyfile import conf.d/*.Caddyfile ``` + +## Handling errors + +We can setup seperate error pages for different kind of error. But I'll be using single `error.html` page which is a [caddy template](https://caddyserver.com/docs/caddyfile/directives/templates) page and I can fill in error msg and error code using [placeholders](https://caddyserver.com/docs/modules/http.handlers.templates#placeholder). +For reference look at [error.html](./error.html) file. + +To learn more about it check the Caddy docs **RTFM** about [handling errors](https://caddyserver.com/docs/caddyfile/directives/handle_errors).