Skip to content
Go back
Envoy

The CNCF-graduated edge and service proxy — the data plane underneath Istio and many API gateways.

HTTP QUERY method support in Envoy

http: add support for the QUERY method (RFC 10008)

Envoy's HTTP/1 codec rejected the new QUERY method that HTTP/2 and HTTP/3 already forwarded. It now routes QUERY the same way on all three, and enforces the RFC's Content-Type rule.

Status
Merged
Merged
24 Aug 2026
Area
HTTP/1 codec · connection manager
C++
Diff
359 lines added and 9 removed across 23 files

The problem

RFC 10008 registers QUERY: a method that is safe and idempotent like GET, but carries its query in the request body rather than the URL. It exists for searches and filters too large or too structured to fit in a query string.

The same structured search sent three ways. As GET it overflows the query string. As POST it fits in the body, but POST is neither safe nor idempotent. As QUERY it travels in the body with a Content-Type and stays safe, idempotent and cacheable. The same structured search sent three ways. As GET it overflows the query string. As POST it fits in the body, but POST is neither safe nor idempotent. As QUERY it travels in the body with a Content-Type and stays safe, idempotent and cacheable.

Envoy’s handling of it depended on the protocol version. HTTP/2 and HTTP/3 keep no method allowlist, so they forwarded it. HTTP/1 rejected it with a 400 (HPE_INVALID_METHOD), because the parser checks the method against a fixed list of known methods that predates the RFC. The same request succeeded or failed depending on how the client connected.

A client sends QUERY over HTTP/1.1, HTTP/2 and HTTP/3. Before the change, HTTP/2 and HTTP/3 forward it and the HTTP/1 codec rejects it against its known methods with 400 HPE_INVALID_METHOD. After QUERY joins the list, all three forward it. A client sends QUERY over HTTP/1.1, HTTP/2 and HTTP/3. Before the change, HTTP/2 and HTTP/3 forward it and the HTTP/1 codec rejects it against its known methods with 400 HPE_INVALID_METHOD. After QUERY joins the list, all three forward it.

The only workaround was allow_custom_methods. It accepts any token as a method, and the API still marks it as work in progress.

What I changed

Each change sits at a different stage of the path a request takes through Envoy.

Envoy's request path. A client connects to a listener, and the HTTP connection manager builds a codec per connection: the Balsa parser for HTTP/1, whose known-method list now includes QUERY, or the HTTP/2 or HTTP/3 codec. For each request, ActiveStream::decodeHeaders() runs the header validator, whose IANA list now includes QUERY, and rejects a QUERY with no Content-Type. The request runs the HTTP filter chain to the router, where isSafeRequest() keeps QUERY out of 0-RTT and automatic 425 retries, and on to the upstream. The four changed parts are marked. Envoy's request path. A client connects to a listener, and the HTTP connection manager builds a codec per connection: the Balsa parser for HTTP/1, whose known-method list now includes QUERY, or the HTTP/2 or HTTP/3 codec. For each request, ActiveStream::decodeHeaders() runs the header validator, whose IANA list now includes QUERY, and rejects a QUERY with no Content-Type. The request runs the HTTP filter chain to the router, where isSafeRequest() keeps QUERY out of 0-RTT and automatic 425 retries, and on to the upstream. The four changed parts are marked.

A QUERY with a Content-Type passes from the codec through the connection manager and router to the upstream. A QUERY without one stops at the connection manager, which sends a local 400 query_missing_content_type while the client's connection stays open. A QUERY with a Content-Type passes from the codec through the connection manager and router to the upstream. A QUERY without one stops at the connection manager, which sends a local 400 query_missing_content_type while the client's connection stays open.

Unit tests cover the parser, codec, header validator and connection manager. An integration test routes a QUERY through every combination of downstream and upstream protocol.

Judgement calls

QUERY is safe, but not by Envoy’s definition of safe. The RFC defines QUERY as safe, yet I kept it out of isSafeRequest() on purpose. One reviewer questioned the exclusion and another asked how it would interact with 0-RTT early data. Tracing that through the code showed that callers of isSafeRequest() assume a safe request has no body. That function decides whether a request may be sent as 0-RTT early data, and whether a 425 triggers an automatic retry, which for a request with a body means buffering the body. Marking QUERY safe would have changed both behaviours without anyone deciding to. I left a TODO where the function is implemented and a note at each call site, so a later change can’t alter either behaviour by accident.

While Envoy resumes an HTTP/3 connection to the upstream, a GET with no body goes in the 0-RTT flight. QUERY is outside isSafeRequest(), so it waits for the handshake to complete and is never retried automatically on 425. While Envoy resumes an HTTP/3 connection to the upstream, a GET with no body goes in the 0-RTT flight. QUERY is outside isSafeRequest(), so it waits for the handshake to complete and is never retried automatically on 425.

Only the missing Content-Type is enforced. The RFC also rejects a Content-Type that doesn’t match the body. Checking that would mean buffering and inspecting the content, and only the origin server knows which query formats it supports. A proxy that guessed would do more harm than good, so the code comment says this was deliberate rather than an oversight.

What review changed

Reviewers moved the change closer to the RFC: they asked for the Content-Type rule to be enforced now rather than later, and for the two new header fields to be registered. My first version put the Content-Type check behind a second runtime guard of its own. The reviewers, and then the maintainer, agreed that one flag was enough: the check can only be reached if HTTP/1 accepts QUERY, and that is already guarded. So the second guard came out.

Outcome

Merged on 24 August 2026, closing #46404. The release note lists it under minor behaviour changes.

Timeline

  1. 1 Aug 2026
    Pull request opened
  2. 24 Aug 2026
    Merged after 23 days in review
  3. 13 Oct 2026
    Released in Envoy v1.40.0

All open source work →All case studies →