Retry failed requests to the origin directly

To avoid downtime or user impact in the unlikely case that GraphCDN is experiencing issues, you can retry failed requests and send them to your origin directly.

If you would like to set this up with a GraphQL client that is not yet mentioned here, please ping us at support@graphcdn.io. We'd be happy to work on a solution with you.

Apollo Client

With Apollo Client's RetryLink we can swap out the underlying HttpLink when retrying a failed response and point it directly at the origin:

const retryLink = new RetryLink().split(
// If the operation is ok…
(operation) => operation.getContext().response?.ok !== false,
// …send requests through the GraphCDN service…
new HttpLink({ uri: 'https://<name>.graphcdn.app' }),
// …otherwise retry requests to the origin directly
new HttpLink({ uri: 'https://api.<name>.com/graphql' }),
)
const client = new ApolloClient({
cache: new InMemoryCache(),
link: retryLink,
})

Live demo

Apollo Client is configured to send a request to a GraphCDN service that always throws an error. Once that happens, it retries the same operation but sends it directly to the origin instead, which completes the request.