majodev / google-webfonts-helper

A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets
https://gwfh.mranftl.com
MIT License
12.02k stars 420 forks source link

Caching issue ? #128

Closed dregad closed 2 years ago

dregad commented 2 years ago

I noticed today that Google Font's CSS was serving me a new version of Open Sans v21 https://fonts.googleapis.com/css2?family=Open+Sans (note the v21 in the URL)

/* cyrillic-ext */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/opensans/v21/mem8YaGs126MiZpBA-UFWJ0bbck.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
<snip>

So I went to download the new .woff file with google-webfont-helper, but realized that it was still returning an older v20:

$ curl -s https://google-webfonts-helper.herokuapp.com/api/fonts/open-sans |jq '{family,version,lastModified}' 
{
  "family": "Open Sans",
  "version": "v20",
  "lastModified": "2021-05-19"
}

The Google API does return v21, updated just yesterday:

$ curl -s "https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDY-C-Lt9uyPP5fSTjMCR4bB944SlI4spw&sort=popularity" |jq '.items[1] | {family,version,lastModified}'
{
  "family": "Open Sans",
  "version": "v21",
  "lastModified": "2021-08-04"
}

So I'm guessing there a cache on google-webfont-helper, but the question is when does it get refreshed ?

dregad commented 2 years ago

I guess it was some kind of caching issue. Both APIs now return v22.