如何禁用 text/html 的 gzip 压缩? [英] How to disable gzip compression for text/html?

查看:66
本文介绍了如何禁用 text/html 的 gzip 压缩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 gzip 配置如下所示:

My gzip config looks like this:

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1500;
gzip_types text/css application/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;

您会注意到 text/html 不在我的类型列表中,但 Chrome 显示它无论如何都是 gzipped.这篇文章text/html 默认启用.由于安全原因,我想禁用它.我该怎么做?

You will notice that text/html is not in my list of types, but Chrome is showing that it's gzipped anyway. This article says that text/html is enabled by default. I want to disable it for security reasons. How can I do that?

推荐答案

来自 文档:

text/html"类型的响应总是被压缩.

Responses with the "text/html" type are always compressed.

您可以完全禁用 gzip:

You can disable gzip entirely:

gzip off

本文建议完全禁用 SSL 压缩.

This article suggests disabling SSL compression entirely.

这篇关于如何禁用 text/html 的 gzip 压缩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆