当客户端请求头包含 Accept-Encoding: gxip, deflate, br 时,S3 + Cloudfront 无法提供 .gz/.br 静态文件。
- 在构建时压缩文件,并将 s3 文件夹中的 index.html、index.html.gz 和 index.html.br 添加到其中。
- 在 Cloudfront 的白名单中添加 Accept encoding 头。
- 在 S3 的 CORS 配置中添加 Content-Length。
- 为 index.html.gz 添加 gzip 编码和 index.html.br 添加 br 编码,并将 Content-Type 设置为 text/html。
- 禁用 Cloudfront 的自动压缩功能。