graphql / graphql-js

A reference implementation of GraphQL for JavaScript
http://graphql.org/graphql-js/
MIT License
20.02k stars 2.02k forks source link

CDN Caching recommendations #3888

Open EmmanuelPonnudurai opened 1 year ago

EmmanuelPonnudurai commented 1 year ago

What is the official recommendation from the graphql org team on CDN caching?

With Graphql inherently being a HTTP POST, it makes it rather hard to set up CDN caching rules at edge servers. There are products which help achieve this. Some of them I have listed below,

Coming to actual edge servers, some of them like Fastly, Akamai, cloudflare have varying levels of support to allow caching of Graphql HTTP post. But it also means vendor lock in and in some cases a complete re write in the way things are managed from the application standpoint.

I am looking for some guidance in terms of CDN caching in general. The docs do not seem to list anything about this (or may be I didn't look properly). The only thing I saw is https://graphql.org/learn/caching/ and it is geared towards the client caching but not CDN caching.

Since CDN caching and HTTP mechanisms to allow caching are universally used by several parties involved, often times with a rule of only HTTP GET, I feel like this is an area which is a bit obscure when it comes to GraphQL and looking for any valuable information which helps achieve this goal without vendor lock ins or large changes to existing system.

OR, is it safe to assume that CDN caching is out of scope for graphql org and each implementor should do as they see fit to accommodate it?

Any recommendations and guidance will be much appreciated from the community in this regard. Thank you.

n1ru4l commented 1 year ago

How some servers do caching:

SaaS Solutions: