diff --git a/agent/kvs_endpoint.go b/agent/kvs_endpoint.go
index e645b64cc0..feb6b7bfd2 100644
--- a/agent/kvs_endpoint.go
+++ b/agent/kvs_endpoint.go
@@ -197,7 +197,11 @@ func (s *HTTPServer) KVSPut(resp http.ResponseWriter, req *http.Request, args *s
// Check the content-length
if req.ContentLength > int64(s.agent.config.KVMaxValueSize) {
resp.WriteHeader(http.StatusRequestEntityTooLarge)
- fmt.Fprintf(resp, "Value exceeds %d byte limit", s.agent.config.KVMaxValueSize)
+ fmt.Fprintf(resp,
+ "Request body(%d bytes) too large, max size: %d bytes. See %s.",
+ req.ContentLength, s.agent.config.KVMaxValueSize,
+ "https://www.consul.io/docs/agent/options.html#kv_max_value_size",
+ )
return nil, nil
}
diff --git a/agent/txn_endpoint.go b/agent/txn_endpoint.go
index 0edb874780..c478fa958e 100644
--- a/agent/txn_endpoint.go
+++ b/agent/txn_endpoint.go
@@ -88,7 +88,11 @@ func (s *HTTPServer) convertOps(resp http.ResponseWriter, req *http.Request) (st
// Check Content-Length first before decoding to return early
if req.ContentLength > maxTxnLen {
resp.WriteHeader(http.StatusRequestEntityTooLarge)
- fmt.Fprintf(resp, "Request body too large, max size: %v bytes", maxTxnLen)
+ fmt.Fprintf(resp,
+ "Request body(%d bytes) too large, max size: %d bytes. See %s.",
+ req.ContentLength, maxTxnLen,
+ "https://www.consul.io/docs/agent/options.html#txn_max_req_len",
+ )
return nil, 0, false
}
@@ -99,7 +103,11 @@ func (s *HTTPServer) convertOps(resp http.ResponseWriter, req *http.Request) (st
// The request size is also verified during decoding to double check
// if the Content-Length header was not set by the client.
resp.WriteHeader(http.StatusRequestEntityTooLarge)
- fmt.Fprintf(resp, "Request body too large, max size: %v bytes", maxTxnLen)
+ fmt.Fprintf(resp,
+ "Request body too large, max size: %d bytes. See %s.",
+ maxTxnLen,
+ "https://www.consul.io/docs/agent/options.html#txn_max_req_len",
+ )
} else {
// Note the body is in API format, and not the RPC format. If we can't
// decode it, we will return a 400 since we don't have enough context to
diff --git a/website/source/docs/agent/options.html.md b/website/source/docs/agent/options.html.md
index f5079ff314..3ba0809c06 100644
--- a/website/source/docs/agent/options.html.md
+++ b/website/source/docs/agent/options.html.md
@@ -1449,12 +1449,23 @@ Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'."
single RPC call to a Consul server. See
https://en.wikipedia.org/wiki/Token_bucket for more details about how
token bucket rate limiters operate.
+ *
+ `kv_max_value_size` - **(Advanced)** Configures the maximum number of
+ bytes for a kv request body to the [`/v1/kv`](/api/kv.html) endpoint.
+ This limit defaults to [raft's](https://github.com/hashicorp/raft)
+ suggested max size(512KB). **Note that tuning these improperly can cause
+ Consul to fail in unexpected ways**, it may potentially affect
+ leadership stability and prevent timely heartbeat signals by increasing
+ RPC IO duration.
+ This option affects the txn endpoint too, but Consul 1.7.2 introduced
+ `txn_max_req_len` which is the preferred way to set the limit for the
+ txn endpoint. If both limits are set, the higher one takes precedence.
*
- `txn_max_req_len` - Configures the maximum number of
+ `txn_max_req_len` - **(Advanced)** Configures the maximum number of
bytes for a transaction request body to the [`/v1/txn`](/api/txn.html)
endpoint. This limit defaults to [raft's](https://github.com/hashicorp/raft)
- suggested max size. **Note that increasing beyond this default can
- cause Consul to fail in unexpected ways**, it may potentially affect
+ suggested max size(512KB). **Note that tuning these improperly can cause
+ Consul to fail in unexpected ways**, it may potentially affect
leadership stability and prevent timely heartbeat signals by
increasing RPC IO duration.