Created
January 25, 2011 11:16
-
-
Save lindsayevans/794800 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add correct content-type for fonts | |
AddType application/vnd.ms-fontobject .eot | |
AddType font/ttf .ttf | |
AddType font/otf .otf | |
AddType font/x-woff .woff | |
AddType image/svg+xml .svg | |
# Compress compressible fonts | |
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml | |
# Add a far future Expires header for fonts | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
ExpiresByType font/ttf "access plus 1 year" | |
ExpiresByType font/otf "access plus 1 year" | |
ExpiresByType font/x-woff "access plus 1 year" | |
ExpiresByType image/svg+xml "access plus 1 year" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add correct content-type for fonts | |
types { | |
application/vnd.ms-fontobject eot; | |
font/ttf ttf; | |
font/otf otf; | |
font/x-woff woff; | |
image/svg+xml svg; | |
} | |
# Compress compressible fonts | |
gzip on; | |
gzip_comp_level 9; | |
gzip_types font/ttf font/otf image/svg+xml; | |
# Add a far future Expires header for fonts | |
if ($request_uri ~* "\.(eot|ttf|otf|woff|svg)$") { | |
expires max; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<!-- Add correct content-type for fonts --> | |
<staticContent> | |
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> | |
<mimeMap fileExtension=".ttf" mimeType="font/ttf" /> | |
<mimeMap fileExtension=".otf" mimeType="font/otf" /> | |
<mimeMap fileExtension=".woff" mimeType="font/x-woff" /> | |
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> | |
</staticContent> | |
<!-- Compress compressible fonts --> | |
<httpCompression> | |
<scheme name="deflate" dll="%Windir%\system32\inetsrv\gzip.dll" /> | |
<staticTypes> | |
<add mimeType="font/ttf" enabled="true" /> | |
<add mimeType="font/otf" enabled="true" /> | |
<add mimeType="image/svg+xml" enabled="true" /> | |
</staticTypes> | |
</httpCompression> | |
<!-- Add a far future Expires header for fonts --> | |
<!-- (There doesn't appear to be a way to do this for individual types, or to set based on access time, so we're setting it to 1 year in the future for all static content) --> | |
<staticContent> | |
<clientCache httpExpires="Mon, 24 Jan 2012 00:00:00 GMT" cacheControlMode="UseExpires" /> | |
</staticContent> | |
</system.webServer> |
Hi, great thanks! :-)
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
This increased total transfer data in my case, js, css... are ignored to compress
It should be font/woff for .woff and font/woff2 for .woff2 👍
https://www.w3.org/Fonts/REC-WOFF-20121213-errata.html
https://tools.ietf.org/html/rfc8081#section-4.4.5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey thanks for this! It really helped :)