Skip to content

Conversation

albaad
Copy link

@albaad albaad commented Oct 5, 2023

  • What it solves: Adds the ability to explicitly enable Cache-Control headers even when GraphQL responses contain errors. This is useful for scenarios where certain error outcomes should be cacheable (e.g., 400/404 for missing or not-yet-available resources), allowing downstream caches/CDNs to respect custom max-age and scope.
  • How: Introduces a helper cache.ContextWithForceCacheControl(ctx, true) that marks a request as eligible for Cache-Control header emission even when errors are present. The middleware uses this signal to compute and write the header from existing cache hints.
  • Why: Some APIs benefit from caching specific error responses to reduce load and improve latency, particularly for predictable cases like resource not found or not ready yet.
  • Docs: README updated with example usage showing how to enable forced cache control on error cases.

@landrade
Copy link
Owner

landrade commented Feb 24, 2024

Hi @albaad,

Could you add an explanation of what this PR resolve in the description?

@albaad
Copy link
Author

albaad commented Sep 11, 2025

Hi @landrade,

I’ve updated the PR description with an explanation of what it resolves—sorry for the long delay! Let me know if you need anything else.

@aartal
Copy link

aartal commented Sep 30, 2025

Hi @landrade,

Just checking if there’s anything missing or something I can do to help move this forward. Happy to address any feedback or make further changes if needed.

Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants