Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Clarify traffic shaping compression headers in documentation ([PR #8773](https://github.com/apollographql/router/pull/8773))

The traffic shaping documentation now clearly explains how the router handles HTTP compression headers for subgraph requests. It clarifies that `content-encoding` is set when compression is configured via `traffic_shaping`, while `accept-encoding` is automatically set on all subgraph requests to indicate the router can accept compressed responses (`gzip`, `br`, or `deflate`). The documentation also notes that these headers are added after requests are added to the debug stack, so they won't appear in the Connectors Debugger.

By [@gigi](https://github.com/the-gigi-apollo) in https://github.com/apollographql/router/pull/8773
17 changes: 15 additions & 2 deletions docs/source/routing/performance/traffic-shaping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

### Compression

The router can compress request bodies to subgraphs (along with response bodies to clients).
The router can compress request bodies sent to subgraphs, along with response bodies returned to clients.

Check notice on line 165 in docs/source/routing/performance/traffic-shaping.mdx

View check run for this annotation

Apollo Librarian / AI Style Review

docs/source/routing/performance/traffic-shaping.mdx#L165

Use "and" instead of "along with" for simplicity and conciseness. ```suggestion The router can compress request bodies sent to subgraphs and response bodies returned to clients. ```
It currently supports these algorithms: `gzip`, `br`, and `deflate`.

```yaml title="router.yaml"
Expand All @@ -171,7 +171,20 @@
compression: gzip # Enable gzip compression for all subgraphs.
```

Subgraph response decompression is always supported for these algorithms: `gzip`, `br`, and `deflate`.
#### Compression headers

When you configure compression for subgraph traffic, the router automatically manages HTTP compression headers:

- **`content-encoding` header**: When you enable compression using `traffic_shaping.all.compression` or `traffic_shaping.subgraphs.<name>.compression`, the router sets this header on outgoing requests to subgraphs. This header indicates the router compressed the request body using the specified algorithm (for example, `content-encoding: gzip`).
- **`accept-encoding` header**: The router automatically sets this header on all subgraph requests to indicate it accepts compressed responses. The router always accepts responses compressed with `gzip`, `br`, or `deflate`, whether or not you configure outgoing compression.

Check notice on line 179 in docs/source/routing/performance/traffic-shaping.mdx

View check run for this annotation

Apollo Librarian / AI Style Review

docs/source/routing/performance/traffic-shaping.mdx#L179

Use "whether" instead of "whether or not" for simplicity, as the negative is implied. ```suggestion - **`accept-encoding` header**: The router automatically sets this header on all subgraph requests to indicate it accepts compressed responses. The router always accepts responses compressed with `gzip`, `br`, or `deflate`, whether you configure outgoing compression. ```

The router always indicates it accepts compressed responses using the `accept-encoding` header, but it only compresses request bodies when you configure the `compression` option.

<Note>

The router adds these headers to requests after adding them to the debug stack, so the headers don't appear in the Connectors Debugger. They are present in the actual HTTP requests sent to subgraphs.

Check warning on line 185 in docs/source/routing/performance/traffic-shaping.mdx

View check run for this annotation

Apollo Librarian / AI Style Review

docs/source/routing/performance/traffic-shaping.mdx#L185

The pronoun "them" is ambiguous and could refer to "headers". Clarifying that it refers to "requests" explains why the headers are missing from the debug stack. ```suggestion The router adds these headers to requests after adding the requests to the debug stack, so the headers don't appear in the Connectors Debugger. They are present in the actual HTTP requests sent to subgraphs. ```

</Note>

<Note>

Expand Down