diff --git a/docs/source/performance/caching.md b/docs/source/performance/caching.md index 4c256454af1..cebe44df854 100644 --- a/docs/source/performance/caching.md +++ b/docs/source/performance/caching.md @@ -331,12 +331,7 @@ The effect of setting `honorSubgraphCacheControlHeader` to `false` is to have no ## Caching with a CDN -Whenever Apollo Server sends an operation response that is cacheable, it includes a `Cache-Control` HTTP header that describes the response's cache policy. - -To be cacheable, all of the following must be true: -- The operation has a non-zero `maxAge`. -- The operation has a single response rather than an [incremental delivery](../workflow/requests#incremental-delivery-experimental) response. -- There are no errors in the response. +By default, Apollo Server sends a `Cache-Control` header with all responses that describes the response's cache policy. When the response is cacheable, the header has this format: @@ -346,6 +341,11 @@ Cache-Control: max-age=60, private When the response is not cacheable, the header has the value `Cache-Control: no-store`. +To be cacheable, all of the following must be true: +- The operation has a non-zero `maxAge`. +- The operation has a single response rather than an [incremental delivery](../workflow/requests#incremental-delivery-experimental) response. +- There are no errors in the response. + If you run Apollo Server behind a CDN or another caching proxy, you can configure it to use this header's value to cache responses appropriately. See your CDN's documentation for details (for example, here's the [documentation for Amazon CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html#expiration-individual-objects)). Some CDNs require custom headers for caching or custom values in the `cache-control` header like `s-maxage`. You can configure your `ApolloServer` instance accordingly by telling the built-in cache control plugin to just calculate a policy without setting HTTP headers, and specifying your own [plugin](../integrations/plugins): diff --git a/packages/integration-testsuite/src/httpServerTests.ts b/packages/integration-testsuite/src/httpServerTests.ts index 5a97caa41e9..cff02ce2f14 100644 --- a/packages/integration-testsuite/src/httpServerTests.ts +++ b/packages/integration-testsuite/src/httpServerTests.ts @@ -964,7 +964,7 @@ export function defineIntegrationTestSuiteHttpServerTests( }); }); - it('cache-control not set without any hints', async () => { + it('cache-control set to no-store without any hints', async () => { const app = await createApp({ schema, });