Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
NGINX如何启用HTTP基本身份验证页Gzip_Nginx_Gzip_Http Auth - Fatal编程技术网

NGINX如何启用HTTP基本身份验证页Gzip

NGINX如何启用HTTP基本身份验证页Gzip,nginx,gzip,http-auth,Nginx,Gzip,Http Auth,以下是我的gzip设置: ## # Gzip Settings ## gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 5; # Don't compress anything under 256 bytes gzip_min_length 256; # gzip_buffers 16 8k; gzip_http_version 1.1; gzip_disable 'MSIE

以下是我的gzip设置:

##
  # Gzip Settings
  ##

  gzip on;

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 5;
  # Don't compress anything under 256 bytes
  gzip_min_length     256;
  # gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_disable  'MSIE [1-6]\.(?!.*SV1)';
  gzip_types
   application/atom+xml
   application/javascript
   application/json
   application/rss+xml
   application/vnd.ms-fontobject
   application/x-font-ttf
   application/x-font-opentype
   application/x-font-truetype
   application/x-javascript
   application/x-web-app-manifest+json
   application/xhtml+xml
   application/xml
   font/eot
   font/opentype
   font/otf
   image/svg+xml
   image/x-icon
   image/vnd.microsoft.icon
   text/css
   text/plain
   text/javascript
   text/x-component;
curl-IL

HTTP/2 401

服务器:nginx

日期:2018年12月28日星期五14:09:26 GMT

内容类型:text/html;字符集=UTF-8

内容长度:7326

www-authenticate:Basic-realm=“已启用隐私”

etag:“5c262af8-1c9e”

正如您所看到的,该页面不是由gzip启用的


如何启用401页gzip?

在您的curl示例中,类型是
text/html
,它不在您的
gzip\u类型中


text/html
添加到
gzip\u类型中
,它应该可以工作

我发现gzip_中缺少类型
text/html
。您可以将其添加到列表中吗?如果您不希望gzip text/html,请更改401响应的内容类型。是否有关于@fiveelements注释的任何更新?mimeType text/html已丢失,因此将被排除,100%确定。