summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/server.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2023-05-16 11:27:52 -0400
committerGitHub <noreply@github.com>2023-05-16 15:27:52 +0000
commitcbf16f6d9eb77f37d6eb588ff3e54cfdfddecc21 (patch)
treeef48ed58e9f0374df46cabecd7edf29c2be019e2 /modules/caddyhttp/server.go
parent13a37688dcdc1ffa8e9322dad0bffac0c0c9893a (diff)
caddyhttp: Implement named routes, `invoke` directive (#5107)
* caddyhttp: Implement named routes, `invoke` directive * gofmt * Add experimental marker * Adjust route compile comments
Diffstat (limited to 'modules/caddyhttp/server.go')
-rw-r--r--modules/caddyhttp/server.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 411ec72..d2de09b 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -102,6 +102,16 @@ type Server struct {
// The error routes work exactly like the normal routes.
Errors *HTTPErrorConfig `json:"errors,omitempty"`
+ // NamedRoutes describes a mapping of reusable routes that can be
+ // invoked by their name. This can be used to optimize memory usage
+ // when the same route is needed for many subroutes, by having
+ // the handlers and matchers be only provisioned once, but used from
+ // many places. These routes are not executed unless they are invoked
+ // from another route.
+ //
+ // EXPERIMENTAL: Subject to change or removal.
+ NamedRoutes map[string]*Route `json:"named_routes,omitempty"`
+
// How to handle TLS connections. At least one policy is
// required to enable HTTPS on this server if automatic
// HTTPS is disabled or does not apply.