|
| 1 | +--- |
| 2 | +title: TLS, mTLS and HTTP/2 Support in Hive Router |
| 3 | +description: |
| 4 | + Hive Router has the first-class TLS and mTLS support for both inbound and outbound connections, alongside |
| 5 | + end-to-end HTTP/2 with optional h2c for subgraph traffic. |
| 6 | +date: 2026-04-30 |
| 7 | +authors: [arda] |
| 8 | +--- |
| 9 | + |
| 10 | +import { Callout } from "@hive/design-system/hive-components/callout"; |
| 11 | + |
| 12 | +[Hive Router](/docs/router) is now available with the first-class **TLS / mTLS** support and full |
| 13 | +**HTTP/2** coverage on both directions in the router from clients all the way down to subgraphs |
| 14 | +including [HTTP/2 cleartext (h2c)](https://datatracker.ietf.org/doc/html/rfc7540). |
| 15 | + |
| 16 | +## TLS and mTLS, end-to-end |
| 17 | + |
| 18 | +TLS can be configured independently on each connection segment, and mTLS is supported in both |
| 19 | +directions. The router can terminate TLS for inbound API consumers and act as a TLS client for |
| 20 | +outbound subgraph traffic by using its own client certificate when subgraphs require mutual |
| 21 | +authentication. |
| 22 | + |
| 23 | +``` |
| 24 | +Client ──[TLS / mTLS]──► Router ──[TLS / mTLS]──► Subgraph(s) |
| 25 | + inbound outbound |
| 26 | +``` |
| 27 | + |
| 28 | +### Inbound (Client -> Router) |
| 29 | + |
| 30 | +Enable HTTPS on the router itself by pointing it at a certificate and key. The same TLS port also |
| 31 | +upgrades secure WebSocket (`wss://`) connections automatically, so subscriptions work over TLS |
| 32 | +without any extra configuration. |
| 33 | + |
| 34 | +```yaml title="router.config.yaml" |
| 35 | +traffic_shaping: |
| 36 | + router: |
| 37 | + tls: |
| 38 | + cert_file: /etc/router/tls/server.crt |
| 39 | + key_file: /etc/router/tls/server.key |
| 40 | +``` |
| 41 | +
|
| 42 | +For mTLS, add a `client_auth` section with the trusted client CA so only clients presenting a |
| 43 | +valid certificate can reach the router. |
| 44 | + |
| 45 | +### Outbound (Router -> Subgraphs) |
| 46 | + |
| 47 | +Configure subgraph TLS globally under `all`, or override it per subgraph. Both directions of |
| 48 | +mutual authentication are supported so that the router can verify subgraph certificates and present |
| 49 | +its own identity when subgraphs require it. |
| 50 | + |
| 51 | +```yaml title="router.config.yaml" |
| 52 | +traffic_shaping: |
| 53 | + all: |
| 54 | + tls: |
| 55 | + cert_file: /etc/router/tls/subgraph-ca.crt |
| 56 | + client_auth: |
| 57 | + cert_file: /etc/router/tls/router-client.crt |
| 58 | + key_file: /etc/router/tls/router-client.key |
| 59 | + subgraphs: |
| 60 | + products: |
| 61 | + tls: |
| 62 | + cert_file: /etc/router/tls/products-ca.crt |
| 63 | +``` |
| 64 | + |
| 65 | +## End-to-end HTTP/2 |
| 66 | + |
| 67 | +Hive Router now negotiates HTTP/2 transparently for both inbound and outbound TLS connections, |
| 68 | +and exposes a new outbound option to enforce HTTP/2 even on plain HTTP using |
| 69 | +[HTTP/2 cleartext (h2c)](https://datatracker.ietf.org/doc/html/rfc7540). |
| 70 | + |
| 71 | +```yaml title="router.config.yaml" |
| 72 | +traffic_shaping: |
| 73 | + all: |
| 74 | + allow_only_http2: true |
| 75 | +``` |
| 76 | + |
| 77 | +When `allow_only_http2` is enabled: |
| 78 | + |
| 79 | +- Plain HTTP subgraph connections use **h2c** with HTTP/2 prior knowledge. |
| 80 | +- HTTPS subgraph connections require HTTP/2 and **do not** fall back to HTTP/1.1. |
| 81 | + |
| 82 | +Like other outbound options, `allow_only_http2` can be set globally under `all` or overridden per |
| 83 | +subgraph, so you can enable HTTP/2 only where it makes sense. |
| 84 | + |
| 85 | +<Callout type="info"> |
| 86 | + |
| 87 | +Both features are covered by the router's E2E test suite, including HTTPS, mTLS in both |
| 88 | +directions, and HTTP/2 between the router and subgraphs. |
| 89 | + |
| 90 | +</Callout> |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +- [TLS & mTLS guide](/docs/router/security/tls) |
| 95 | +- [`traffic_shaping` configuration reference](/docs/router/configuration/traffic_shaping) |
0 commit comments