summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-08-26 16:31:55 -0400
committerGitHub <noreply@github.com>2021-08-26 14:31:55 -0600
commit403732c433b816409e3525a9f49b4cc90abc2486 (patch)
tree9c017f8ab0e01c907ae71bc6c76bb2cdebc39d42 /caddyconfig/httpcaddyfile
parentf6d5ec2fd68c2b9ae3104c0e2650b37f07a552e1 (diff)
httpcaddyfile: Reorder some directives (#4311)
We realized we made some mistakes with the directive ordering, so we're making some minor adjustments. `abort` and `error` don't really make sense to be after other handler directives, because you would expect to be able to "fail-fast" and throw an error before falling through to some `file_server` or `respond` typically. So we're moving them up to just before `respond`, i.e. before the common handler directives. This is also more consistent with our existing examples in the docs, which actually didn't work due to the directive ordering. See https://caddyserver.com/docs/caddyfile/directives/error#examples Also, `push` doesn't quite make sense to be after `handle`/`route`, since its job is to read from response headers to push additional resources if necessary, and `handle`/`route` may be terminal so push would not be reached if it was declared outside those. And also, it would make sense to be _before_ `templates` because a template _could_ add a `Link` header to the response dynamically.
Diffstat (limited to 'caddyconfig/httpcaddyfile')
-rw-r--r--caddyconfig/httpcaddyfile/directives.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go
index 800e892..360f91e 100644
--- a/caddyconfig/httpcaddyfile/directives.go
+++ b/caddyconfig/httpcaddyfile/directives.go
@@ -44,9 +44,9 @@ var directiveOrder = []string{
"request_body",
"redir",
- "rewrite",
// URI manipulation
+ "rewrite",
"uri",
"try_files",
@@ -54,23 +54,23 @@ var directiveOrder = []string{
"basicauth",
"request_header",
"encode",
+ "push",
"templates",
// special routing & dispatching directives
"handle",
"handle_path",
"route",
- "push",
// handlers that typically respond to requests
+ "abort",
+ "error",
"respond",
"metrics",
"reverse_proxy",
"php_fastcgi",
"file_server",
"acme_server",
- "abort",
- "error",
}
// directiveIsOrdered returns true if dir is