We're using the Link
header to preload our font files and it's working great when the browser cache is empty. However on "Repeat View" the font files are loaded twice and Chrome shows a warning message. How can we fix that?
The Link
header and the CSS files both point to the full relative URL:
/app/themes/foobar/assets/fonts/Montserrat-Light.woff
First View:
Repeat View:
The problem was a missing crossorigin
, so instead of:
Link: </path/to/font.woff2>; rel=preload; as=font
Use:
Link: </path/to/font.woff2>; rel=preload; as=font; crossorigin