Q27: How does HTTP Caching differ between REST and GraphQL?

Difficulty:IntermediateTopic:Caching

REST leverages native HTTP caching primitives (like Cache-Control, ETag, 304 status codes) via resource URIs and GET requests.

GraphQL uses POST requests to a single /graphql URL, rendering standard HTTP URL caching ineffective. Instead, GraphQL caching relies on:

  1. Client-side Normalized Caching (by __typename + id inside Apollo/Relay).
  2. Persisted Queries / Automated Persisted Queries (APQ) to allow HTTP GET caching.
Key Takeaways
  • GraphQL POST operations bypass default CDN/HTTP path caching.
  • Client caches normalize graphs into key-value stores using unique object IDs.
Knowledge Check

What primary feature prevents standard HTTP CDNs from caching default GraphQL queries?