For the HTTP protocol, compressing the response data can reduce the amount of data transferred, thereby shortening response time, saving server bandwidth, and improving client performance.
This task guides you on how to compress a response through API Gateway.
By default, API Gateway supports response compression based on the GZIP compression algorithm. To implement this feature, the following requirements need to be met:
Accept-Encodingheader and its value contains
Content-Typeof the response body is
If the client request meets the requirements above, API Gateway will return the compressed response body to the client and contain the
Content-Encoding: gzip header in the response.
Content-Encoding: gzipheader. Otherwise, response compression will not take effect.