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:
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:
2
Answers
Did you include the
ExpiresActive on
?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:
This was initially discussed in the WOFF File Format 2.0 – W3C Working Draft 14 April 2015 – Appendix A: Internet Media Type Registration
I don’t think
application/woff2
has ever been a (proposed) mime-type? The IANA Media Types initially definedapplication/font-woff
for woff font files, so by extension you could assume thatapplication/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 offont/woff
and list onlyfont/woff2
for woff2 font files.You shouldn’t need to manually add the
AddType
directive here. Providing you are using a relatively recent distro of Apache then themime.types
file that is imported (using theTypesConfig
directive) during startup already includes the necessary (and correct) mime-type for.woff2
files:See also: