@@ -130,6 +130,9 @@ scripts.
130
130
that Consul will perform. This is specified using a label suffix like "30s"
131
131
or "1h". This must be greater than or equal to "1s"
132
132
133
+ - ` method ` ` (string: "GET") ` - Specifies the HTTP method to use for HTTP
134
+ checks.
135
+
133
136
- ` name ` ` (string: "service: <name> check") ` - Specifies the name of the health
134
137
check.
135
138
@@ -159,6 +162,27 @@ scripts.
159
162
- ` tls_skip_verify ` ` (bool: false) ` - Skip verifying TLS certificates for HTTPS
160
163
checks. Requires Consul >= 0.7.2.
161
164
165
+ #### ` header ` Stanza
166
+
167
+ HTTP checks may include a ` header ` stanza to set HTTP headers. The ` header `
168
+ stanza parameters have lists of strings as values. Multiple values will cause
169
+ the header to be set multiple times, once for each value.
170
+
171
+ ``` hcl
172
+ service {
173
+ check {
174
+ type = "http"
175
+ port = "lb"
176
+ path = "/_healthz"
177
+ interval = "5s"
178
+ timeout = "2s"
179
+ header {
180
+ Authorization = ["Basic ZWxhc3RpYzpjaGFuZ2VtZQ=="]
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
162
186
163
187
## ` service ` Examples
164
188
@@ -232,8 +256,8 @@ argument provided as a value to the `args` array.
232
256
233
257
This example shows a service with an HTTP health check. This will query the
234
258
service on the IP and port registered with Nomad at ` /_healthz ` every 5 seconds,
235
- giving the service a maximum of 2 seconds to return a response. Any non-2xx code
236
- is considered a failure.
259
+ giving the service a maximum of 2 seconds to return a response, and include an
260
+ Authorization header. Any non-2xx code is considered a failure.
237
261
238
262
``` hcl
239
263
service {
@@ -243,6 +267,9 @@ service {
243
267
path = "/_healthz"
244
268
interval = "5s"
245
269
timeout = "2s"
270
+ header {
271
+ Authorization = ["Basic ZWxhc3RpYzpjaGFuZ2VtZQ=="]
272
+ }
246
273
}
247
274
}
248
275
```
@@ -269,6 +296,7 @@ service {
269
296
path = "/_healthz"
270
297
interval = "5s"
271
298
timeout = "2s"
299
+ method = "POST"
272
300
}
273
301
274
302
check {
0 commit comments