Applies to: ✔️ Front Door Standard ✔️ Front Door Premium
本文可帮助你排查 Azure Front Door 中的文件压缩问题。
Symptom
已经为路由启用了压缩功能,但返回的文件没有压缩。
Tip
在 HTTP 响应中查找 Content-Encoding 标头。 If it has a value of gzip, bzip2, or deflate, your content is compressed. If it has a value of gzip, bzip2, or deflate, your content is compressed.
Cause
可能的原因包括:
- 内容不符合压缩条件。
- 未为相应文件类型启用压缩功能。
- HTTP 请求缺少有效的压缩类型标头。
- 源正在发送分块内容。
Troubleshooting steps
Tip
Azure Front Door 的配置更改最多可能需要 10 分钟才能完成传播。 如果这是你第一次设置压缩功能,请等待 1-2 小时,以确保设置已传播到 POP。
验证请求
Use your browser's developer tools to check the requests:
- 确保将请求发送到
<endpointname>.z01.azurefd.net,而不是源。 - Ensure the request includes an Accept-Encoding header with gzip, deflate, or bzip2.
验证压缩设置
In the Azure portal, navigate to your endpoint and select Configure in the Routes panel. Ensure compression is enabled.
Check the request at the origin server for a Via header
The Via header indicates a proxy server. By default, Microsoft IIS servers don't compress responses with a Via header. 若要替代此设置,请执行以下操作:
- IIS 6: Set HcNoCompressionForProxies="FALSE" in the IIS Metabase properties. 请参阅 IIS 6 压缩。
- IIS 7 及更高版本:在服务器配置中将 noCompressionForHttp10 和 noCompressionForProxies 设置为 False。 See HTTP Compression.
Next steps
有关详细信息,请参阅 Azure Front Door 常见问题解答。