raycloud
V2EX  ›  问与答

请教一个 tomcat gzip 的问题

  •  1
     
  •   raycloud · Aug 21, 2015 · 2031 views
    This topic created in 4117 days ago, the information mentioned may be changed or developed.
    tomcat8 启用了 gzip, 在其 ROOT 目录下放了两个 css 文件,访问的时候其中一个文件的头信息有
    Content-Encoding gzip , 另一个比较大的文件却没有,请问是怎么回事?
    http://120.25.56.115:8090/style.css
    http://120.25.56.115:8090/style2.css
    这两个文件,你们看下, style2 的内容只是把 style 的内容多复制了一遍, style2.css 没有被压缩
    tomcat 配置:
    <Connector port="8090" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="9443"
    compression="on"
    compressionMinSize="2048"
    noCompressionUserAgents="gozilla, traviata"
    compressableMimeType="text/html,text/xml,text/css,text/javascript,application/x-javascript,application/javascript,image/gif,image/jpg,image/jpeg,image/bmp,image/png,application/x-font-woff,application/vnd.ms-fontobject"
    />
    3 replies  •  2015-08-21 17:40:30 +08:00
    funky
    funky
    Aug 21, 2015
    1
    我这边看到的两个文件都有 gzip 的头 window chrome 44
    raycloud
    raycloud
    OP
    Aug 21, 2015
    2
    @funky 不是吧?我也是 windows chrome 44 ,用几个浏览器也试了, style2.css 响应没 gzip 头,大小大也原文件大小 58KB , 它的内容只是 style.css 的双倍,而 style.css 响应的大小为 5.4KB
    hcymk2
    hcymk2
    Aug 21, 2015
    3
    我的第 2 个响应头里面没有 Content-Encoding gzip.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1967 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:49 · PVG 19:49 · LAX 03:49 · JFK 06:49
    ♥ Do have faith in what you're doing.