Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 21:45 UTC
chore: Comment fixes (#4634)
Francis Lavoie committed
Mar 13, 2022 at 01:38 UTC
a9c7e94a38e4f4719a5c1cf7f3e11e8cf427f04e
5 files changed
+33
-21
caddyconfig/httpcaddyfile/directives.go
+2
-2
@@ -43,7 +43,7 @@ var directiveOrder = []string{
43
"root",
44
45
"header",
46
- "copy_response_headers",
46
+ "copy_response_headers", // only in reverse_proxy's handle_response
47
"request_body",
48
49
"redir",
@@ -69,7 +69,7 @@ var directiveOrder = []string{
69
// handlers that typically respond to requests
70
"abort",
71
"error",
72
- "copy_response",
72
+ "copy_response", // only in reverse_proxy's handle_response
73
"respond",
74
"metrics",
75
"reverse_proxy",
modules/caddyhttp/reverseproxy/caddyfile.go
+25
-13
@@ -53,8 +53,8 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
53
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
54
//
55
// reverse_proxy [<matcher>] [<upstreams...>] {
56
-// # upstreams
57
-// to <upstreams...>
56
+// # backends
57
+// to <upstreams...>
58
// dynamic <name> [...]
59
//
60
// # load balancing
@@ -63,26 +63,28 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
63
// lb_try_interval <interval>
64
//
65
// # active health checking
66
-// health_uri <uri>
67
-// health_port <port>
66
+// health_uri <uri>
67
+// health_port <port>
68
// health_interval <interval>
69
-// health_timeout <duration>
70
-// health_status <status>
71
-// health_body <regexp>
69
+// health_timeout <duration>
70
+// health_status <status>
71
+// health_body <regexp>
72
// health_headers {
73
// <field> [<values...>]
74
// }
75
//
76
// # passive health checking
77
-// max_fails <num>
78
-// fail_duration <duration>
79
-// max_conns <num>
80
-// unhealthy_status <status>
77
+// fail_duration <duration>
78
+// max_fails <num>
79
+// unhealthy_status <status>
80
// unhealthy_latency <duration>
81
+// unhealthy_request_count <num>
82
//
83
// # streaming
84
// flush_interval <duration>
85
// buffer_requests
86
+// buffer_responses
87
+// max_buffer_size <size>
88
//
89
// # header manipulation
90
// trusted_proxies [private_ranges] <ranges...>
@@ -94,14 +96,23 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
96
// ...
97
// }
98
//
97
-// # intercepting responses
99
+// # optionally intercept responses from upstream
100
// @name {
101
// status <code...>
102
// header <field> [<value>]
103
// }
102
-// replace_status <matcher> <status_code>
104
+// replace_status [<matcher>] <status_code>
105
// handle_response [<matcher>] {
106
// <directives...>
107
+//
108
+// # special directives only available in handle_response
109
+// copy_response [<matcher>] [<status>] {
110
+// status <status>
111
+// }
112
+// copy_response_headers [<matcher>] {
113
+// include <fields...>
114
+// exclude <fields...>
115
+// }
116
// }
117
// }
118
//
@@ -1073,6 +1084,7 @@ func parseCopyResponseHeadersCaddyfile(h httpcaddyfile.Helper) (caddyhttp.Middle
1084
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
1085
//
1086
// copy_response_headers [<matcher>] {
1087
+// include <fields...>
1088
// exclude <fields...>
1089
// }
1090
//
modules/caddyhttp/reverseproxy/copyresponse.go
+1
-1
@@ -66,7 +66,7 @@ func (h CopyResponseHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request
66
}
67
68
// allow a custom status code to be written; otherwise the
69
- // status code from the upstream resposne is written
69
+ // status code from the upstream response is written
70
if codeStr := h.StatusCode.String(); codeStr != "" {
71
intVal, err := strconv.Atoi(repl.ReplaceAll(codeStr, ""))
72
if err != nil {
modules/caddypki/adminapi.go
+2
-2
@@ -93,7 +93,7 @@ func (a *adminAPI) handleAPIEndpoints(w http.ResponseWriter, r *http.Request) er
93
}
94
}
95
96
-// handleCAInfo returns cinformation about a particular
96
+// handleCAInfo returns information about a particular
97
// CA by its ID. If the CA ID is the default, then the CA will be
98
// provisioned if it has not already been. Other CA IDs will return an
99
// error if they have not been previously provisioned.
@@ -143,7 +143,7 @@ func (a *adminAPI) handleCAInfo(w http.ResponseWriter, r *http.Request) error {
143
return nil
144
}
145
146
-// handleCACerts returns cinformation about a particular
146
+// handleCACerts returns the certificate chain for a particular
147
// CA by its ID. If the CA ID is the default, then the CA will be
148
// provisioned if it has not already been. Other CA IDs will return an
149
// error if they have not been previously provisioned.
modules/caddypki/command.go
+3
-3
@@ -49,8 +49,8 @@ By default, this command installs the root certificate for Caddy's
49
default CA (i.e. 'local'). You may specify the ID of another CA
50
with the --ca flag.
51
52
-Also, this command will attempt to connect to the Caddy's admin API
53
-running at '` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may
52
+This command will attempt to connect to Caddy's admin API running at
53
+'` + caddy.DefaultAdminListen + `' to fetch the root certificate. You may
54
explicitly specify the --address, or use the --config flag to load
55
the admin address from your config, if not using the default.`,
56
Flags: func() *flag.FlagSet {
@@ -216,7 +216,7 @@ func rootCertFromAdmin(adminAddr string, caID string) (*x509.Certificate, error)
216
}
217
defer resp.Body.Close()
218
219
- // Decode the resposne
219
+ // Decode the response
220
caInfo := new(caInfo)
221
err = json.NewDecoder(resp.Body).Decode(caInfo)
222
if err != nil {