summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-09-24 18:31:01 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2021-09-24 18:31:01 -0600
commit501da21f209c9fad92c65c8ba02a969a03ec5379 (patch)
treec60876dc13b4277bb933feea19b4494a26f639ed /modules/caddyhttp
parent3336faf25466b1b2d9a007f5468d05a887e16775 (diff)
General minor improvements to docs
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/matchers.go12
-rw-r--r--modules/caddyhttp/responsematchers.go2
-rw-r--r--modules/caddyhttp/templates/templates.go3
-rw-r--r--modules/caddyhttp/vars.go11
4 files changed, 18 insertions, 10 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go
index a22a3f1..073f82f 100644
--- a/modules/caddyhttp/matchers.go
+++ b/modules/caddyhttp/matchers.go
@@ -97,7 +97,8 @@ type (
// ```
MatchQuery url.Values
- // MatchHeader matches requests by header fields. It performs fast,
+ // MatchHeader matches requests by header fields. The key is the field
+ // name and the array is the list of field values. It performs fast,
// exact string comparisons of the field values. Fast prefix, suffix,
// and substring matches can also be done by suffixing, prefixing, or
// surrounding the value with the wildcard `*` character, respectively.
@@ -114,7 +115,8 @@ type (
// (potentially leading to collisions).
MatchHeaderRE map[string]*MatchRegexp
- // MatchProtocol matches requests by protocol.
+ // MatchProtocol matches requests by protocol. Recognized values are
+ // "http", "https", and "grpc".
MatchProtocol string
// MatchRemoteIP matches requests by client IP (or CIDR range).
@@ -139,9 +141,9 @@ type (
// matchers within a set work the same (i.e. different matchers in
// the same set are AND'ed).
//
- // Note that the generated docs which describe the structure of
- // this module are wrong because of how this type unmarshals JSON
- // in a custom way. The correct structure is:
+ // NOTE: The generated docs which describe the structure of this
+ // module are wrong because of how this type unmarshals JSON in a
+ // custom way. The correct structure is:
//
// ```json
// [
diff --git a/modules/caddyhttp/responsematchers.go b/modules/caddyhttp/responsematchers.go
index d9ad848..821def9 100644
--- a/modules/caddyhttp/responsematchers.go
+++ b/modules/caddyhttp/responsematchers.go
@@ -32,7 +32,7 @@ type ResponseMatcher struct {
// If set, each header specified must be one of the
// specified values, with the same logic used by the
- // request header matcher.
+ // [request header matcher](/docs/json/apps/http/servers/routes/match/header/).
Headers http.Header `json:"headers,omitempty"`
}
diff --git a/modules/caddyhttp/templates/templates.go b/modules/caddyhttp/templates/templates.go
index 8f2ea2c..80efded 100644
--- a/modules/caddyhttp/templates/templates.go
+++ b/modules/caddyhttp/templates/templates.go
@@ -237,7 +237,8 @@ type Templates struct {
// Default is text/plain, text/markdown, and text/html.
MIMETypes []string `json:"mime_types,omitempty"`
- // The template action delimiters.
+ // The template action delimiters. If set, must be precisely two elements:
+ // the opening and closing delimiters. Default: `["{{", "}}"]`
Delimiters []string `json:"delimiters,omitempty"`
}
diff --git a/modules/caddyhttp/vars.go b/modules/caddyhttp/vars.go
index 479ef0a..5779b5d 100644
--- a/modules/caddyhttp/vars.go
+++ b/modules/caddyhttp/vars.go
@@ -29,9 +29,14 @@ func init() {
caddy.RegisterModule(MatchVarsRE{})
}
-// VarsMiddleware is an HTTP middleware which sets variables
-// in the context, mainly for use by placeholders. The
-// placeholders have the form: `{http.vars.variable_name}`
+// VarsMiddleware is an HTTP middleware which sets variables to
+// have values that can be used in the HTTP request handler
+// chain. The primary way to access variables is with placeholders,
+// which have the form: `{http.vars.variable_name}`, or with
+// the `vars` and `vars_regexp` request matchers.
+//
+// The key is the variable name, and the value is the value of the
+// variable. Both the name and value may use or contain placeholders.
type VarsMiddleware map[string]string
// CaddyModule returns the Caddy module information.