简体   繁体   English

如何在 AWS Appsync 中为 GraphQL API 响应启用压缩

[英]How to enable compression for GraphQL API responses in AWS Appsync

I've deployed a GraphQL API in AWS Appsync.我在 AWS Appsync 中部署了一个 GraphQL API。

I observed that the API response I'm getting (JSON) is not being compressed, compressing the response will lower the latency time.我观察到我收到的 API 响应 (JSON) 没有被压缩,压缩响应会降低延迟时间。

According to AWS Docs ,根据AWS 文档

To enable compression, a client must send the Accept-Encoding header with the value gzip or br,要启用压缩,客户端必须发送值为 gzip 或 br 的 Accept-Encoding header,

but even though I've sent the specified header, I'm getting the uncompressed data, which caused the delay in latency.但即使我发送了指定的 header,我得到的是未压缩的数据,这导致了延迟延迟。

Any workaround to resolve this??解决这个问题的任何解决方法?

It seems to be a known issue: https://github.com/aws/aws-appsync-community/issues/15这似乎是一个已知问题: https://github.com/aws/aws-appsync-community/issues/15

The only known workaround seems to be to set up a CloudFormation for the Appsync where you are able to enable compression唯一已知的解决方法似乎是为 Appsync 设置 CloudFormation,您可以在其中启用压缩

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM