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

NGINX How to make HTTP Basic Auth pages Gzip enable

这是我的gzip设置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
##
  # 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;


<支付>
如您所见,该页面未被gzip启用

如何使401页启用gzip?


在您的curl示例中,类型为text/html,它不在您的gzip_types中。

text/html添加到gzip_types,它应该可以工作。