Skip to content

Commit 0342762

Browse files
authored
doc(http): Add specific HTTP configuration documentation (#141)
1 parent 1cddb9f commit 0342762

File tree

3 files changed

+75
-27
lines changed

3 files changed

+75
-27
lines changed

docs/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ Protect supports various running modes for different needs and purposes.
1414
* `validate` runs as a CLI tool, validating your Persisted Operations against your schema and configured protections (see [this page](configuration.md#graphql-protect---validate-run-mode) for more info how to set this up)
1515
* `version` outputs versioning info of protect
1616

17+
## HTTP configuration
18+
19+
* [HTTP Configuration](http.md)
20+
*
1721
## Protections
1822

1923
This section contains all the documentation about each protection feature.
2024

21-
* [Persisted Operations](protections/trusted_documents)
25+
* [Persisted Operations](protections/trusted_documents.md)
2226
* [Block Field Suggestions](protections/block_field_suggestions.md)
2327
* [Max Aliases](protections/max_aliases.md)
2428
* [Max Tokens](protections/max_tokens.md)

docs/configuration.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,32 @@ The following outlines the structure of the yaml, as well as outlines the **defa
1212

1313
```yaml
1414
web:
15+
# Maximum duration to read the entire request
1516
read_timeout: 5s
17+
# Maximum duration before timing out writes of the response
1618
write_timeout: 10s
19+
# Maximum time to wait between idle requests for keep alive
1720
idle_timeout: 120s
21+
# Time to wait until forcibly shutting down protect, after receiving a shutdown signal
1822
shutdown_timeout: 20s
23+
# host and port to listen on
1924
host: 0.0.0.0:8080
25+
# path that receives GraphQL traffic
2026
path: /graphql
2127
# limit the maximum size of a request body that is allowed
2228
# this helps prevent OOM attacks through excessively large request payloads.
2329
# A limit of `0` disables this protection.
2430
request_body_max_bytes: 102400
2531

2632
target:
33+
# Target host and port to send traffic to after validating
2734
host: http://localhost:8081
35+
# Dial timeout waiting for a connection to complete with the target upstream
2836
timeout: 10s
37+
# Interval of keep alive probes
2938
keep_alive: 180s
30-
target:
39+
tracing:
40+
# Headers to redact when sending tracing information
3141
redacted_headers: []
3242

3343
schema:
@@ -170,28 +180,4 @@ max_batch:
170180
enabled: true
171181
# The maximum number of operations within a single batched request.
172182
max: 5
173-
```
174-
175-
## HTTP Request Body Max Byte size
176-
177-
To prevent OOM attacks through excessively large request bodies, a default limit is posed on request body size of `100kb`. This limit is generally speaking ample space for GraphQL request bodies, while also providing solid protections.
178-
179-
You can modify this limit by changing the following configuration option
180-
181-
```yaml
182-
web:
183-
# limit the maximum size of a request body that is allowed
184-
# this helps prevent OOM attacks through excessively large request payloads.
185-
# A limit of `0` disables this protection.
186-
request_body_max_bytes: 102400
187-
```
188-
189-
### Metrics
190-
191-
A metric is exposed to track if and when a request is rejected that exceeds this limit.
192-
193-
```
194-
graphql_protect_http_request_max_body_bytes_exceeded_count{}
195-
```
196-
197-
No metrics are produced for requests that do not exceed this limit.
183+
```

docs/http.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# HTTP Configuration
2+
3+
## HTTP server configuration
4+
5+
```yaml
6+
web:
7+
# Maximum duration to read the entire request
8+
read_timeout: 5s
9+
# Maximum duration before timing out writes of the response
10+
write_timeout: 10s
11+
# Maximum time to wait between idle requests for keep alive
12+
idle_timeout: 120s
13+
# Time to wait until forcibly shutting down protect, after receiving a shutdown signal
14+
shutdown_timeout: 20s
15+
# host and port to listen on
16+
host: 0.0.0.0:8080
17+
# path that receives GraphQL traffic
18+
path: /graphql
19+
# limit the maximum size of a request body that is allowed
20+
# this helps prevent OOM attacks through excessively large request payloads.
21+
# A limit of `0` disables this protection.
22+
request_body_max_bytes: 102400
23+
24+
target:
25+
# Target host and port to send traffic to after validating
26+
host: http://localhost:8081
27+
# Dial timeout waiting for a connection to complete with the target upstream
28+
timeout: 10s
29+
# Interval of keep alive probes
30+
keep_alive: 180s
31+
tracing:
32+
# Headers to redact when sending tracing information
33+
redacted_headers: []
34+
```
35+
36+
## HTTP Request Body Max Byte size
37+
38+
To prevent OOM attacks through excessively large request bodies, a default limit is posed on request body size of `100kb`. This limit is generally speaking ample space for GraphQL request bodies, while also providing solid protections.
39+
40+
You can modify this limit by changing the following configuration option
41+
42+
```yaml
43+
web:
44+
# limit the maximum size of a request body that is allowed
45+
# this helps prevent OOM attacks through excessively large request payloads.
46+
# A limit of `0` disables this protection.
47+
request_body_max_bytes: 102400
48+
```
49+
50+
### Metrics
51+
52+
A metric is exposed to track if and when a request is rejected that exceeds this limit.
53+
54+
```
55+
graphql_protect_http_request_max_body_bytes_exceeded_count{}
56+
```
57+
58+
No metrics are produced for requests that do not exceed this limit.

0 commit comments

Comments
 (0)