docs: Add 404 handling

This commit is contained in:
Francis Lavoie 2020-05-17 17:16:44 -04:00
parent e0f5ee1bb9
commit bb089ddb37
No known key found for this signature in database
GPG key ID: 7D1A27F0725BE5D8
2 changed files with 37 additions and 0 deletions

View file

@ -15,3 +15,16 @@ rewrite /docs/modules/* /docs/modules/index.html
rewrite /docs/* /docs/index.html rewrite /docs/* /docs/index.html
reverse_proxy /api/* localhost:4444 reverse_proxy /api/* localhost:4444
handle_errors {
@error {
expression {http.error.status_code} in [404, 500]
}
handle @error {
rewrite 404.html
root * src
encode gzip
templates
file_server
}
}

24
src/404.html Normal file
View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>404 &mdash; Caddy Documentation</title>
{{include "/includes/docs-head.html"}}
<meta property="og:title" content="404 - Caddy Documentation">
<meta name="twitter:title" value="404 - Caddy Documentation">
</head>
<body>
{{include "/includes/docs-header.html"}}
<main>
{{include "/includes/docs-nav.html"}}
<div class="article-container">
<div class="paper" id="paper1"></div>
<div class="paper" id="paper2"></div>
<article class="paper paper3">
{{markdown "# 404\n\n<center>Sorry! The page you requested wasn't found.</center>"}}
</article>
</div>
<div class="sidebar"></div>
</main>
{{include "/includes/footer.html"}}
</body>
</html>