AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[gzip](server)

Martin Hope
Henrik Ormåsen
Asked: 2021-10-20 03:58:02 +0800 CST

从工件注册表(Maven)下载文件

  • 1

我一直在使用 REST API for Artifact Registry。我可以找到我想下载的 .zip 文件的 URL,但我只收到 JSON 响应。是否可以使用 Maven 项目从工件注册表下载单个工件文件?

来源:方法:projects.locations.repositories.files.get

现在看来我需要使用mvn并gradle执行此操作,这在我的情况下会很不方便。

google-cloud-platform cloud gzip repository maven
  • 1 个回答
  • 628 Views
Martin Hope
user549144
Asked: 2020-12-26 22:37:45 +0800 CST

无法在 Apache 中关闭 SSLCompression?

  • 2

我的 Apache 是 2.4.46 并且使用的是 Openssl 版本 1.1.1f

我已经设置了指令SSLCompression Off。即使我启用它,它也会说不支持 SSL 压缩,我想这很好。

但是,当我使用 Firefox 查看网页的 HTTP 标头时,我会看到以下响应标头:

HTTP/2 200 OK
date: Fri, 25 Dec 2020 12:13:58 GMT
server: Apache
expires: -1
cache-control: no-store, no-cache, must-revalidate, max-age=0
pragma: no-cache
content-security-policy: default-src https: 'unsafe-inline' 'unsafe-hashes' 'self'; img-src data: https: 'self'
x-frame-options: DENY
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: no-referrer
permissions-policy: geolocation=();midi=();notifications=();push=();sync-xhr=(self);microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();
vary: Accept-Encoding
content-encoding: gzip
content-length: 3299
content-type: text/html; charset=UTF-8
X-Firefox-Spdy: h2

那句话是:content-encoding: gzip让我担心。

但是,即使我使用 cURL 在 PHP 中使用此脚本来获取页面:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//enable headers
curl_setopt($ch, CURLOPT_HEADER, 1);
//get only headers
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0");
curl_setopt($ch, CURLOPT_ENCODING, "gzip");

它返回这些 HTTP 标头:


HTTP/2 200 
date: Fri, 25 Dec 2020 12:16:45 GMT
server: Apache
set-cookie: __Secure-CCJRLSESSID=g7m99kljvea2g5uk58f5lfskr1; path=/; secure; HttpOnly; SameSite=Lax
expires: -1
cache-control: no-store, no-cache, must-revalidate, max-age=0
pragma: no-cache
content-security-policy: default-src https: 'unsafe-inline' 'unsafe-hashes' 'self'; img-src data: https: 'self'
x-frame-options: DENY
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: no-referrer
permissions-policy: geolocation=();midi=();notifications=();push=();sync-xhr=(self);microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();
content-type: text/html; charset=UTF-8

这让我很困惑。我什至清除了 Firefox 中的缓存,但没有运气。我不想受到 CRIME 攻击。反过来,我可以完全禁用 gzip。但在我这样做之前,我想知道为什么会发生这种情况。也许是 Firefox 的错误??

更新:

它也发生在 chrome 中。

mod_deflate 配置:

SSLCompression Off
<IfModule deflate_module>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
</IfModule>
ssl compression gzip apache-2.4
  • 2 个回答
  • 691 Views
Martin Hope
Himanshu
Asked: 2020-10-21 11:25:28 +0800 CST

以 Gzipped 格式发送时数据被截断

  • 1

我正在将压缩数据从客户端发送到 Apache 服务器,并在 Apache 层对其进行膨胀(使用https://httpd.apache.org/docs/2.4/mod/mod_deflate.html#input)。然后数据从 Apache 发送到 Tomcat,但是,在 Tomcat 我得到截断的数据。

寻找这个并发现下面针对 Apache 服务器提出的错误。 https://bz.apache.org/bugzilla/show_bug.cgi?id=34526

根据上面链接中提到的解决方案,我需要添加一个 Apache 环境变量“JK_IGNORE_CL”。我试图设置这个变量,但是,我无法让它工作。
以下是我用来设置此属性的指令(在 .htaccess 文件中)。仅当请求将 Content-Encoding 作为 gzip 时,我才尝试设置此变量。

SetEnvIf 内容编码 gzip JK_IGNORE_CL

我还尝试为其提供一些值,例如 JK_IGNORE_CL=true 或 JK_IGNORE_CL=1 ,但是,它不起作用。我不确定,启用此功能的预期方法是什么。任何帮助表示赞赏。

gzip apache-2.4
  • 2 个回答
  • 335 Views
Martin Hope
dr0i
Asked: 2020-08-19 00:42:42 +0800 CST

Apache:压缩为 zip(不是 gzip)

  • 0

我已配置apache 2.4为在将内容交付给客户端之前对其进行压缩,mod_deflate并使用客户端标头设置为"Accept-Encoding: gzip". 所以我已经开始工作了,生成了一个有效的 gzipped 文件:

curl --header "Accept-Encoding: gzip" https://my.website/ > content.gz

有没有办法允许"Accept-Encoding: zip"压缩为zip?

据我了解文档这似乎是不可能的:

gzip 编码是唯一支持以确保与旧浏览器实现完全兼容的编码。不支持 deflate 编码...(https://httpd.apache.org/docs/2.4/mod/mod_deflate.html)

问题来自Windows无法解压缩gzip文件的用户(我猜只使用 Windows 本机工具)。

[编辑:正如 gerald-schneider 所指出的,浏览器会自动解压缩内容——但我们正在使用curl这样的命令行工具来编写 API 脚本,因此不涉及浏览器。也感谢所有其他答案和评论,我想我应该更精确,即写下curl开始的命令]。

windows gzip apache-2.4 deflate zip
  • 3 个回答
  • 510 Views
Martin Hope
SoftTimur
Asked: 2020-05-24 15:28:20 +0800 CST

使用 docker 和 bitnami/nginx 启用 gzip

  • 0

我用 docker 和bitnami/nginx镜像部署了一个网站:https ://www.10studio.tech/demo 。部署后,我意识到像这样的文件analyzejs.js没有被压缩:

在此处输入图像描述

这里是docker-compose.yml:

version: "3"
services:
  docusaurus:
    image: bitnami/nginx:1.16
    restart: always
    volumes:
    - ./build:/app
    - ./certs:/certs:ro
    - ./my_server_block.conf:/opt/bitnami/nginx/conf/server_blocks/my_server_block.conf:ro
    ports:
    - "3001:3001"
    - "3002:3002"

这里是my_server_block.conf:

server {
  listen  3002;
  absolute_redirect off;
  root  /app;

  location = / {
    rewrite ^(.*)$ https://$http_host/docs/introduction redirect;
  }

  location / {
    try_files $uri $uri/ =404;
  }
}

server {
  listen  3001 ssl;

  ssl_certificate      /certs/server.crt;
  ssl_certificate_key  /certs/server.key;

  ssl_session_cache    shared:SSL:1m;
  ssl_session_timeout  5m;

  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers  on;

  location / {
    proxy_pass http://localhost:3002;
    proxy_redirect off;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Ssl on;
  }
}

这是/opt/bitnami/nginx/conf/nginx.conf,其中 gzip 似乎已启用:

I have no name!@8317023de7ec:/app$ cat /opt/bitnami/nginx/conf/nginx.conf
# Based on https://www.nginx.com/resources/wiki/start/topics/examples/full/#nginx-conf
# user              www www;  ## Default: nobody

worker_processes  auto;
error_log         "/opt/bitnami/nginx/logs/error.log";
pid               "/opt/bitnami/nginx/tmp/nginx.pid";

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format    main '$remote_addr - $remote_user [$time_local] '
                       '"$request" $status  $body_bytes_sent "$http_referer" '
                       '"$http_user_agent" "$http_x_forwarded_for"';
    access_log    "/opt/bitnami/nginx/logs/access.log";
    add_header    X-Frame-Options SAMEORIGIN;

    client_body_temp_path  "/opt/bitnami/nginx/tmp/client_body" 1 2;
    proxy_temp_path        "/opt/bitnami/nginx/tmp/proxy" 1 2;
    fastcgi_temp_path      "/opt/bitnami/nginx/tmp/fastcgi" 1 2;
    scgi_temp_path         "/opt/bitnami/nginx/tmp/scgi" 1 2;
    uwsgi_temp_path        "/opt/bitnami/nginx/tmp/uwsgi" 1 2;

    sendfile           on;
    tcp_nopush         on;
    tcp_nodelay        off;
    gzip               on;
    gzip_http_version  1.0;
    gzip_comp_level    2;
    gzip_proxied       any;
    gzip_types         text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    keepalive_timeout  65;
    ssl_protocols      TLSv1 TLSv1.1 TLSv1.2;

    include  "/opt/bitnami/nginx/conf/server_blocks/*.conf";

    # HTTP Server
    server {
        # port to listen on. Can also be set to an IP:PORT
        listen  8080;

        location /status {
            stub_status on;
            access_log   off;
            allow 127.0.0.1;
            deny all;
        }
    }
}

有谁知道这里出了什么问题以及如何启用 gzip?

nginx gzip docker bitnami
  • 1 个回答
  • 604 Views
Martin Hope
Mahmoud Moravej
Asked: 2017-03-14 22:05:24 +0800 CST

IIS Formal Brotli 压缩模块

  • 0

IIS 是否有任何正式的扩展来支持 brotli 压缩?以前我看到这两个扩展,但我不能依赖它们作为生产服务器:

  • https://www.iis.net/downloads/community/2016/03/iis-brotli
  • https://my.we-amp.com/downloads/iisbrotli
iis compression gzip windows-server-2012-r2
  • 1 个回答
  • 502 Views
Martin Hope
Betty Von Schmartenhausen
Asked: 2017-03-12 06:24:19 +0800 CST

使用 dd 和 gzip 进行备份和恢复

  • 2

我看过各种帖子讨论使用 dd 创建驱动器映像并仅存储“使用过的数据”。在提出问题/问题之前,让我们假设一些事情。

假设

  1. 克隆/映像的驱动器是 /dev/sda
  2. /dev/sda 是 10TB
  3. /dev/sda 上的已用空间为 1TB
  4. 映像存储到某个远程 CIFS 安装位置

问题/问题

将选项cp与--sparse=always选项一起使用dd应该会生成一个稀疏文件,以便文件显示为 1GB:

cp --sparse=always <(dd if=/dev/sda bs=8M) /mnt/remote/location/disk.img

或者像下面这样,应该压缩所有归零的空间:

dd if=/dev/sda1 | gzip -c > /mnt/remote/location/disk.img.gz

那么,稀疏的图像文件对恢复有什么影响呢?传输的数据是 1GB 还是 10GB,包括感知到的空白/归零空间?这显然是评估潜在网络负载和恢复时间的考虑因素。

PS 我知道还有其他选项,例如 Clonezilla 和 ddrescue 之类的选项将允许恢复功能,但问题是关于在上述上下文中使用 dd 的具体问题。

谢谢。

backup linux clone gzip dd
  • 2 个回答
  • 7016 Views
Martin Hope
John W. Nesk
Asked: 2017-02-09 13:45:41 +0800 CST

大型mysql转储管道到s3

  • 0

使用大量数据执行此操作有什么问题吗?

mysqldump ... | gzip | s3cmd put - s3://bucket/file.sql.gz

MySQL 转储的大小约为 100GB。如果 gzip 或 s3cmd 不能足够快地处理转储会发生什么?它会溢出管道缓冲区吗?

backup mysql amazon-s3 gzip pipe
  • 2 个回答
  • 930 Views
Martin Hope
Dennis C.
Asked: 2016-12-18 05:32:56 +0800 CST

nginx gzip Vary 标头以及现有的 Vary 标头

  • 7

我正在尝试激活 gzip 压缩,并且已将选项 gzip_vary 设置为打开;包括 Vary: Accept-Encoding 标头。

问题是,我的应用程序已经设置了 Vary: 标头。所以响应现在有两个 Vary: headers,一个来自我的应用程序,一个来自 nginx。

HTTP/1.1 200 OK
Server: nginx
Date: Sat, 17 Dec 2016 13:28:38 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
Last-Modified: Sat, 17 Dec 2016 13:28:38 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Vary: User-Agent
Content-Encoding: gzip

但我想它应该是这样的:

Vary: Accept-Encoding, User Agent

我怎样才能做到这一点?

nginx gzip
  • 2 个回答
  • 3654 Views
Martin Hope
John Pangilinan
Asked: 2016-12-04 04:34:44 +0800 CST

Nginx Gzip 不工作

  • 2

正如标题所说,Nginx Gzip 不起作用,我尝试了许多分散在互联网上的配置都没有起作用,当简单的事情不起作用时,我真的很沮丧。

gzip.conf:

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
    text/plain
    text/css
    application/json
    application/javascript
    application/x-javascript
    text/xml
    application/xml
    application/xml+rss
    text/javascript
    application/vnd.ms-fontobject
    application/x-font-ttf
    font/opentype
    image/svg+xml
    image/x-icon;

Chrome:

在此处输入图像描述

在此处输入图像描述

Chrome Audit: 在此处输入图像描述

Curl: 在此处输入图像描述

我已经清除了缓存,一切都还是一样。

========================

更新:

我已经测试了 gzip 压缩

http://checkgzipcompression.com/

并给了我:

在此处输入图像描述

但Chrome其中显示:

在此处输入图像描述

Firefox:

在此处输入图像描述

removed gzip_vary

* Hostname was NOT found in DNS cache
*   Trying 192.168.200.240...
* Connected to 192.168.200.240 (192.168.200.240) port 80 (#0)
> HEAD /js/main.js HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.200.240
> Accept: */*
> Accept-Encoding: deflate, gzip
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Sat, 03 Dec 2016 16:25:34 GMT
Date: Sat, 03 Dec 2016 16:25:34 GMT
< Content-Type: application/javascript
Content-Type: application/javascript
< Last-Modified: Fri, 02 Dec 2016 03:20:46 GMT
Last-Modified: Fri, 02 Dec 2016 03:20:46 GMT
< Connection: keep-alive
Connection: keep-alive
< ETag: W/"5840e88e-18ce"
ETag: W/"5840e88e-18ce"
* Server nginx is not blacklisted
< Server: nginx
Server: nginx
< Expires: Sun, 03 Dec 2017 16:25:34 GMT
Expires: Sun, 03 Dec 2017 16:25:34 GMT
< Cache-Control: max-age=31536000
Cache-Control: max-age=31536000
< Content-Encoding: gzip
Content-Encoding: gzip

<
* Connection #0 to host 192.168.200.240 left intact

Without vary on Chrome: 在此处输入图像描述

nginx -V

nginx version: nginx/1.10.1
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/headers-more-nginx-module --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-cache-purge --add-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-development-kit --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/ngx-fancyindex --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nchan --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-lua --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-upload-progress --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-JCHwcf/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module
nginx gzip
  • 3 个回答
  • 18226 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve