嗨,我在压缩字体文件时遇到问题。
我确实有gzip的这段代码,它在所有文件上都可以正常工作:
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_minimum_file_size 500
mod_gzip_maximum_file_size 500000
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html|txt|css|js|php|pl|ico|cur|ttf|woff)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_include mime ^application/x-font-ttf
mod_gzip_item_include mime ^application/x-font-woff
mod_gzip_item_include mime ^image/x-cursor
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
我在字体文件上添加了标题(MINE类型):
AddType application/x-font-ttf .ttf
AddType application/x-font-woff .woff
但是在testing上,我总是收到:
WARNING - (168.7 KB, compressed = 107.2 KB - savings of 61.4 KB) - https://www.paris-web.it/fonts/segoepr.ttf
实际上,他们错过了标题 Content-Encoding:gzip