0. The situation exist in the caddy doc website.
As I can not send URL (new member) I put it in code, sorry.
See : https://github.com/caddyserver/website/blob/master/src/docs/index.html
So I describe the caddy doc website error instead of mine because all source is public.
1. I want to serve a status 404 from a template:
I replicate the code from the caddy website project, but instead serving a 404 pages, an empty 200 page is send.
The code located here
https://github.com/caddyserver/website/blob/master/src/docs/index.html
do not create a 404 error (see https://caddyserver.com/docs/test
)
There is a missing part to handle this code :
{{if not (fileExists $markdownFilePath)}}{{httpError 404}}{{end}}
2. No error message, the page is just a blank page with status 200.
3. Caddy version: Latest
4. How I installed and ran Caddy:
This is the official doc website.
a. System environment:
All
b. Command:
No relevant
d. My complete Caddy config:
see https://github.com/caddyserver/website/blob/master/Caddyfile
5. Links to relevant resources:
Project : GitHub - caddyserver/website: The Caddy website
File with httpError 404 : {{$title}} — Caddy Documentation
Sample (empty 200 instead of 404) : https://caddyserver.com/docs/test