Skip to content

Commit dd9e615

Browse files
committed
Add how-to for ClientSettingsPolicy (nginx#2071)
Problem: As a user, I want a how-to guide to explain how to use the ClientSettingsPolicy API. Solution: Add a how-to guide that explains how to use ClientSettingsPolicy to configure client max body size.
1 parent 48d9a41 commit dd9e615

File tree

12 files changed

+335
-67
lines changed

12 files changed

+335
-67
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Client Settings Policy
22

3-
This directory contains YAML files of ClientSettingsPolicies.
3+
This directory contains the YAML files used in the [ClientSettingsPolicy](https://docs.nginx.com/nginx-gateway-fabric/how-to/traffic-management/client-settings/) guide.

examples/client-settings-policy/csp-grpcroute.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/client-settings-policy/csp-httproutes.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
apiVersion: gateway.nginx.org/v1alpha1
22
kind: ClientSettingsPolicy
33
metadata:
4-
name: gw
5-
namespace: default
4+
name: gateway-client-settings
65
spec:
76
targetRef:
87
group: gateway.networking.k8s.io
98
kind: Gateway
109
name: gateway
1110
body:
12-
maxSize: 10m
13-
timeout: 30s
14-
keepAlive:
15-
requests: 100
16-
time: 5s
17-
timeout:
18-
server: 2s
19-
header: 1s
11+
maxSize: "50" # sizes without a unit are bytes.

examples/client-settings-policy/gateway.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ spec:
99
port: 80
1010
protocol: HTTP
1111
hostname: "*.example.com"
12-
- name: http2
13-
port: 8080
14-
protocol: HTTP
15-
hostname: "*.example.org"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: gateway.nginx.org/v1alpha1
2+
kind: ClientSettingsPolicy
3+
metadata:
4+
name: grpc-client-settings
5+
spec:
6+
targetRef:
7+
group: gateway.networking.k8s.io
8+
kind: GRPCRoute
9+
name: my-grpc-route
10+
body:
11+
maxSize: "75" # sizes without a unit are bytes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: gateway.nginx.org/v1alpha1
2+
kind: ClientSettingsPolicy
3+
metadata:
4+
name: tea-client-settings
5+
spec:
6+
targetRef:
7+
group: gateway.networking.k8s.io
8+
kind: HTTPRoute
9+
name: tea
10+
body:
11+
maxSize: "75" # sizes without a unit are bytes.

site/content/how-to/monitoring/tracing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ NGINX Gateway Fabric supports tracing using [OpenTelemetry](https://opentelemetr
1313

1414
This guide explains how to enable tracing on HTTPRoutes using NGINX Gateway Fabric. It uses the OpenTelemetry Collector and Jaeger to process and collect the traces.
1515

16+
{{< important >}}
17+
Tracing cannot be enabled for [HTTPRoute matches](https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteMatch) with `headers`, `params`, or `method` matchers defined. It will be added in a future release.
18+
{{< /important >}}
19+
1620
## Install the Collectors
1721

1822
The first step is to install the collectors. NGINX Gateway Fabric will be configured to export to the OpenTelemetry Collector, which is configured to export to Jaeger. This model allows the visualization collector (Jaeger) to be swapped with something else, or to add more collectors without needing to reconfigure NGINX Gateway Fabric. It is also possible to configure NGINX Gateway Fabric to export directly to Jaeger.

site/content/how-to/monitoring/troubleshooting.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,31 @@ If using NGINX Gateway Fabric with NGINX Plus as the data plane, you will see th
109109
#### Resolution
110110

111111
To resolve this issue, enable Usage Reporting by following the [Usage Reporting]({{< relref "installation/usage-reporting.md" >}}) guide.
112+
113+
### 413 Request Entity Too Large
114+
115+
#### Description
116+
117+
If you receive the following error:
118+
119+
```text
120+
<html>
121+
<head><title>413 Request Entity Too Large</title></head>
122+
<body>
123+
<center><h1>413 Request Entity Too Large</h1></center>
124+
<hr><center>nginx/1.25.5</center>
125+
</body>
126+
</html>
127+
```
128+
129+
Or view the following error message in the NGINX logs:
130+
131+
```text
132+
2024/05/30 21:48:22 [error] 138#138: *43 client intended to send too large body: 112 bytes, client: 127.0.0.1, server: cafe.example.com, request: "POST /coffee HTTP/1.1", host: "cafe.example.com:8080"
133+
```
134+
135+
The request body exceeds the [client_max_body_size](https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size).
136+
137+
#### Resolution
138+
139+
You can configure the `client_max_body_size` using the `ClientSettingsPolicy` API. Read the [Client Settings Policy]({{< relref "how-to/traffic-management/client-settings.md" >}}) documentation for more information.

0 commit comments

Comments
 (0)