skip to Main Content

Following old advices here and here
I’m curious what is the proper syntax for APACHE server:

AddType font/woff2 .woff2 
ExpiresByType font/woff2 "access plus 1 year"

or

AddType application/woff2 .woff2 
ExpiresByType application/woff2 "access plus 1 year"

2

Answers


  1. Did you include the ExpiresActive on?

    <IfModule mod_expires.c>
      ExpiresActive On
      AddType font/woff2 .woff2 
      ExpiresByType font/woff2 "access plus 1 year"
    </IfModule>
    
    Login or Signup to reply.
  2. what is the proper syntax for APACHE server

    It’s not really a question of "syntax". Both your examples use the same "syntax". But rather, what is the correct/official mime-type (that user-agents understand).

    The official mime-type according to the WOFF2 spec (W3C Recommendation / 1-March-2022) is:

    font/woff2
    

    This was initially discussed in the WOFF File Format 2.0 – W3C Working Draft 14 April 2015 – Appendix A: Internet Media Type Registration

    AddType application/woff2 .woff2 
    

    I don’t think application/woff2 has ever been a (proposed) mime-type? The IANA Media Types initially defined application/font-woff for woff font files, so by extension you could assume that application/font-woff2 would be used for woff2, but I don’t see this documented anywhere? And IANA have since "deprecated" application/font-woff in favour of font/woff and list only font/woff2 for woff2 font files.

    AddType font/woff2 .woff2 
    

    You shouldn’t need to manually add the AddType directive here. Providing you are using a relatively recent distro of Apache then the mime.types file that is imported (using the TypesConfig directive) during startup already includes the necessary (and correct) mime-type for .woff2 files:

    font/woff2                  woff2
    

    See also:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search