首页 > 解决方案 > 如何在响应标头中设置缓存控制

问题描述

如何使用在响应标头中设置缓存控制Apollo-Server

我使用 Angular 作为 FE 和 Graphql Module & Apollo Client 作为我的应用程序的 BE。

以下是响应标头。我不确定这个标题是从哪里应用的。

在此处输入图像描述

我想设置我的自定义标题,我该怎么做?

下面是我的示例代码。

export default new ApolloServer({
  schema,
  context,
  playground: config.isDevelopment,
  uploads: {
    maxFileSize: 3000000, // 3 MB
    maxFiles: 2
  },
  cacheControl: true,
  persistedQueries: {
    cache: apolloCacheInstance
  }
});

标签: angulartypescriptgraphqlapollo-clientapollo-server

解决方案


推荐阅读