ililili
V2EX  ›  问与答

NGINX 下 Gzip 和 Brotli 不压缩字体文件。

  •  1
     
  •   ililili · Sep 25, 2022 · 1933 views
    This topic created in 1366 days ago, the information mentioned may be changed or developed.

    我在 gzip_type 、brotli_type 中添加了 font/ttf ,但是发现并没有起作用,这是为什么呢?

    Supplement 1  ·  Sep 25, 2022
    服了,是浏览器缓存的事,实际已经生效了……
    Lax
        1
    Lax  
       Sep 25, 2022
    先下载那个文件看看 content type 头是什么,在配置文件目录下的 mime.types 里看看配置没有
    ililili
        2
    ililili  
    OP
       Sep 25, 2022
    @Lax 是 application/octet-stream ,mime.types 里面有 application/octet-stream 但是没有 ttf ,我添加了还是不行。
    Lax
        3
    Lax  
       Sep 25, 2022
    按你这个配置,下载时是 application/octet-stream 不对。应该在 mime.types 把字体文件设置成 font/ttf 才会生效
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5481 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 09:21 · PVG 17:21 · LAX 02:21 · JFK 05:21
    ♥ Do have faith in what you're doing.