Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Cache-Control for non-cacheable resources #4461

Closed
jamesarosen opened this issue Aug 6, 2020 · 2 comments
Closed

Set Cache-Control for non-cacheable resources #4461

jamesarosen opened this issue Aug 6, 2020 · 2 comments
Labels
🧬 cache-control Relates to cache directives, headers or packages.

Comments

@jamesarosen
Copy link

Background

apollo-server@2.10.0

When cacheControl.defaultMaxAge == 0 and a resource does not include the @cacheControl directive, apollo-server returns no Cache-Control header.

RFC7231, §6.1 says,

Responses with status codes that are defined as cacheable by default (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501 in this specification) can be reused by a cache with heuristic expiration unless otherwise indicated by the method definition or explicit cache controls [RFC7234]; all other status codes are not cacheable by default.

Some proxies (including CDNs) choose not to cache responses with no cache-control header. Others do.

Expected Outcome

apollo-server returns a Cache-Control header for all responses. One possible default would be max-age=0, no-store.

See Also

@abernix abernix added the 🧬 cache-control Relates to cache directives, headers or packages. label Dec 31, 2020
@timsuchanek
Copy link

In case you don't want to wait for a fix here, shameless plug:
I created a dedicated GraphQL CDN where this is fixed - https://graphcdn.io
We send private, no-store in these cases to make it explicit.

@glasser
Copy link
Member

glasser commented Oct 21, 2022

@glasser glasser closed this as completed Oct 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧬 cache-control Relates to cache directives, headers or packages.
Projects
None yet
Development

No branches or pull requests

4 participants