Skip to main content
This lesson explains the motivation for a proposed HTTP method named QUERY and the practical problem it solves: sending large, structured, read-only inputs (for example, complex search filters) in a way that is cacheable, retryable, and interoperable with intermediaries like CDNs, proxies, and load balancers. Imagine you’re shopping for a T‑shirt on an online store.
A smartphone screen in dark mode showing a shopping app with a grid of t-shirt listings, each tile displaying a colored tee, brand name (Adidas, Puma, Nike, Levi's) and price. Small heart icons indicate save/favorite options.
You apply filters for brand (Nike or Puma), size medium, black color, and under $30. When you hit search, the browser often encodes those filters into the URL as query parameters.
A smartphone screen showing a dark‑mode online shop page for T‑shirts with filter controls for brand (Nike, Puma, Adidas), size (S/M/L), color swatches, and price ranges. The interface shows a "Searching..." status along with search and cart icons.
A typical GET request might look like this:

The problem: URL length and intermediaries

A few query parameters are fine. But as filter sets grow (more fields, lists, nested structures), the URL gets longer. Even if the origin server accepts long URLs, intermediaries in the request path—load balancers, CDNs, reverse proxies, or WAFs—often enforce their own limits and can reject requests with long URLs. For example, AWS CloudFront documents URL size limits of roughly 8 KB; other components may use different thresholds. See AWS CloudFront limits for details: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/limits.html A long search URL can therefore be rejected before it reaches the origin:

Why not put filters in a GET body?

Moving filters into the request body avoids URL-length limits, but GET bodies are not reliably supported across the ecosystem:
  • GET was designed around the URL; servers and intermediaries vary in how they treat GET bodies.
  • Some proxies, CDNs, or frameworks ignore the body or treat the request unpredictably.
  • Certain intermediaries may strip or reject GET requests that include a body.
An example GET with a body (not widely supported):
Due to inconsistent handling, relying on GET bodies is unsafe for cross-network compatibility.

Why not use POST?

POST reliably carries a body, but it introduces other trade-offs:
  • POST is commonly associated with operations that change state (create/update). Because of that, caches and CDNs often treat POST as non-cacheable or apply conservative rules.
  • Caches are less likely to reuse responses to POST requests, making search traffic hit the origin unnecessarily.
  • POST is not guaranteed to be idempotent. Retries of POST may cause unintended side effects (e.g., duplicate orders) unless the server provides deduplication.
An example POST-based search:

Introducing QUERY: a body-friendly, safe, idempotent read method

QUERY is proposed to fill the gap: it carries structured or large read-only input in the request body while clearly declaring the intent that the request is safe (read-only) and idempotent. With that signal, intermediaries that understand QUERY could:
  • Treat QUERY as cacheable (when configured to do so),
  • Use the request body as part of the cache key for identical filter bodies,
  • Allow safe client retries without fear of server-side side effects.
A QUERY request example:

Quick comparison: GET vs POST vs QUERY

Benefits of QUERY

  • Allows long/structured filter payloads in the request body without relying on the URL.
  • Enables caches and CDNs that support QUERY to reuse responses for identical request bodies.
  • Signals safety and idempotence so clients and intermediaries may retry safely and cache more aggressively.

Deployment considerations and checklist

Before adopting QUERY in production, validate compatibility across your entire network path:
  • Confirm that load balancers, CDNs (e.g., CloudFront), reverse proxies, and WAFs recognize QUERY or at least forward it unchanged.
  • Verify how your CDN or cache computes cache keys — can it include the request body for cache lookups?
  • Ensure your application server/framework supports the QUERY method and correctly parses bodies for that method.
  • Test retry behavior in failure scenarios to ensure safe idempotent semantics are preserved.
Recommended test plan:
  • Unit test server handling of QUERY requests and body parsing.
  • Staging: run end-to-end tests across your full network path (load balancers, proxies, CDN, WAF).
  • Production canary: route a small percentage of traffic to QUERY-enabled endpoints and monitor errors and cache hit rates.
What the system needs is a way to put a structured body on an HTTP request while clearly signaling that the request:
  1. Only reads data (does not change server state — i.e., is safe), and
  2. Is idempotent — sending it multiple times has no additional side effects.
This is the role of the QUERY method. A QUERY request carries the filters in the body (like POST) but the method itself communicates the intent: read-only and safe. That could enable intermediaries that recognize QUERY to treat it as cacheable and safe to retry.
Test QUERY thoroughly with your entire network path (CDNs, load balancers, proxies, WAFs). Some providers may not recognize QUERY or might treat it like POST or reject it; verify caching behavior and safe retryability in your environment.

References

Watch Video