Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Options for HTTP/1 Max Headers and Buffer Limits #6194

Merged
merged 34 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
236d560
update hyper to 0.14.31
IvanGoncharov Oct 24, 2024
b66c3f2
Adds `supergraph.experimental_http1_max_headers` option
IvanGoncharov Oct 24, 2024
03760c7
fix lint
IvanGoncharov Oct 24, 2024
2d3e901
Merge branch 'dev' into i1g/max_headers
IvanGoncharov Nov 5, 2024
1969f11
Add experimental_http1_max_buf_size
IvanGoncharov Nov 7, 2024
987e0bb
fix format
IvanGoncharov Nov 7, 2024
22b8239
Use tagged release on our organization
abernix Nov 8, 2024
e39447b
Merge branch 'dev' into i1g/max_headers
abernix Nov 8, 2024
e20fd0b
Merge branch 'dev' into i1g/max_headers
IvanGoncharov Nov 13, 2024
1de4a55
remove duplication in Cargo.toml
IvanGoncharov Nov 13, 2024
199fca0
fix lint
Nov 13, 2024
9d0115a
fix compile error
Nov 13, 2024
9344ef0
Update snapshot
Nov 13, 2024
c0bac69
fix tests
Nov 13, 2024
1491ac0
human-friendly config
Nov 13, 2024
67bdb1f
Add docs
Nov 14, 2024
941aa16
Add crate feature
Nov 14, 2024
f286960
review changes
Nov 14, 2024
1d0bf1f
add feature flag to xtask commands
Nov 14, 2024
6837adf
Apply suggestions from code review
IvanGoncharov Nov 14, 2024
e5c8bd0
Merge branch 'dev' into i1g/max_headers
IvanGoncharov Nov 14, 2024
450b7e7
pass experimental_hyper_header_limits feature to xtask commands
IvanGoncharov Nov 18, 2024
274f062
fix xtask build
IvanGoncharov Nov 18, 2024
2d2c2bf
Merge branch 'dev' into i1g/max_headers
IvanGoncharov Nov 18, 2024
725f510
Update snapshot
IvanGoncharov Nov 18, 2024
c445493
Add missing changeset
IvanGoncharov Nov 18, 2024
ac1b5ac
Fix tests failing without feature flag
IvanGoncharov Nov 18, 2024
c31ce67
Switch kb => kib in tests and docs
IvanGoncharov Nov 18, 2024
e44b154
Revert unwanted changes in Cargo.lock
IvanGoncharov Nov 18, 2024
bea7a96
Merge branch 'dev' into i1g/max_headers
IvanGoncharov Nov 18, 2024
27ef7ab
Address review on changelog
IvanGoncharov Nov 18, 2024
0d2709b
Drop experimental prefix
IvanGoncharov Nov 18, 2024
cdf4e19
experimental_hyper_header_limits => hyper_header_limits
IvanGoncharov Nov 18, 2024
bd686e5
fix CI after removing experimental_
IvanGoncharov Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review on changelog
IvanGoncharov committed Nov 18, 2024
commit 27ef7ab409645c10d0cf5496a20ad5d45a38491a
Original file line number Diff line number Diff line change
@@ -2,11 +2,20 @@

This update introduces experimental configuration options that allow you to adjust the maximum number of HTTP/1 request headers and the maximum buffer size allocated for headers.

Note: These options are marked as experimental not due to instability in their implementation, but because we are currently evaluating whether similar functionality is needed for HTTP/2. If so, we may consider introducing unified options that apply to both protocols.

By default, the Router accepts HTTP/1 requests with up to 100 headers and allocates ~400kib of buffer space to store them. If you need to handle requests with more headers or require a different buffer size, you can now configure these limits in the Router's configuration file:
```yaml
limits:
experimental_http1_request_max_headers: 200
experimental_http1_request_max_buf_size: 200kib
```

Note for Rust Crate Users: If you are using the Router as a Rust crate, the `experimental_http1_request_max_buf_size` option requires the `experimental_hyper_header_limits` feature and also necessitates using Apollo's fork of the Hyper crate until the [changes are merged upstream](https://github.com/hyperium/hyper/pull/3523).
You can include this fork by adding the following patch to your Cargo.toml file:
```toml
[patch.crates-io]
"hyper" = { git = "https://github.com/apollographql/hyper.git", tag = "header-customizations-20241108" }
```

By [@IvanGoncharov](https://github.com/IvanGoncharov) in https://github.com/apollographql/router/pull/6194
7 changes: 7 additions & 0 deletions docs/source/reference/router/configuration.mdx
Original file line number Diff line number Diff line change
@@ -1158,6 +1158,13 @@ If router receives more headers than the buffer size, it responds to the client

Limit the maximum buffer size for the HTTP1 connection. Default is ~400kib.

Note for Rust Crate Users: If you are using the Router as a Rust crate, the `experimental_http1_request_max_buf_size` option requires the `experimental_hyper_header_limits` feature and also necessitates using Apollo's fork of the Hyper crate until the [changes are merged upstream](https://github.com/hyperium/hyper/pull/3523).
You can include this fork by adding the following patch to your Cargo.toml file:
```toml
[patch.crates-io]
"hyper" = { git = "https://github.com/apollographql/hyper.git", tag = "header-customizations-20241108" }
```

#### Parser-based limits

##### `parser_max_tokens`
7 changes: 7 additions & 0 deletions docs/source/routing/security/request-limits.mdx
Original file line number Diff line number Diff line change
@@ -286,6 +286,13 @@ If router receives more headers than the buffer size, it responds to the client

Limit the maximum buffer size for the HTTP1 connection. Default is ~400kib.

Note for Rust Crate Users: If you are using the Router as a Rust crate, the `experimental_http1_request_max_buf_size` option requires the `experimental_hyper_header_limits` feature and also necessitates using Apollo's fork of the Hyper crate until the [changes are merged upstream](https://github.com/hyperium/hyper/pull/3523).
You can include this fork by adding the following patch to your Cargo.toml file:
```toml
[patch.crates-io]
"hyper" = { git = "https://github.com/apollographql/hyper.git", tag = "header-customizations-20241108" }
```

## Parser-based limits

### `parser_max_tokens`