diff --git a/.changesets/docs_clarify_traffic_shaping_compression_headers.md b/.changesets/docs_clarify_traffic_shaping_compression_headers.md new file mode 100644 index 0000000000..96b7d9bda0 --- /dev/null +++ b/.changesets/docs_clarify_traffic_shaping_compression_headers.md @@ -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 diff --git a/docs/source/routing/performance/traffic-shaping.mdx b/docs/source/routing/performance/traffic-shaping.mdx index 4e437e0141..f7228ebc0b 100644 --- a/docs/source/routing/performance/traffic-shaping.mdx +++ b/docs/source/routing/performance/traffic-shaping.mdx @@ -162,7 +162,7 @@ traffic_shaping: ### 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. It currently supports these algorithms: `gzip`, `br`, and `deflate`. ```yaml title="router.yaml" @@ -171,7 +171,20 @@ traffic_shaping: 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..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. + +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. + + + +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. + +