| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,15 +49,9 @@ const vercelMarkdownRoutes = [ | |||
| 49 | 49 | headers: { vary: 'Accept, Accept-Encoding' }, | |
| 50 | 50 | })) | |
| 51 | 51 | ||
| 52 | - /** The facets a family can be narrowed by, which a cache of one has to key on. */ | ||
| 53 | - const familyFacets = ['weights', 'subsets', 'styles', 'provider'] | ||
| 54 | - | ||
| 55 | 52 | /** A day: a family's faces change when a provider republishes it, and a deployment resets this. */ | |
| 56 | 53 | const DAY = 60 * 60 * 24 | |
| 57 | 54 | ||
| 58 | - // The endpoint answers in a format as well, which the page does not ask about. | ||
| 59 | - const familyEntry = { expiration: DAY, allowQuery: [...familyFacets, 'formats'] } | ||
| 60 | - | ||
| 61 | 55 | /** | |
| 62 | 56 | * Where the font caches live. `node_modules` is convenient in development but read-only on most | |
| 63 | 57 | * deployment platforms, where the temporary directory is the one writable path. | |
@@ -149,7 +143,6 @@ export default defineNuxtConfig({ | |||
| 149 | 143 | '/api/v1/**': { headers: { link: '</openapi.json>; rel="service-desc"; type="application/json"' } }, | |
| 150 | 144 | '/api/v1/catalogue.css': { headers: { 'cache-control': 'public, max-age=3600, stale-while-revalidate=86400' } }, | |
| 151 | 145 | '/fonts/**': { headers: { 'cache-control': `public, s-maxage=${DAY}, stale-while-revalidate=${DAY}` } }, | |
| 152 | - '/api/v1/fonts/*': { isr: familyEntry }, | ||
| 153 | 146 | }, | |
| 154 | 147 | prerender: { | |
| 155 | 148 | routes: staticRoutes, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,8 +42,13 @@ export default defineEventHandler(async (event) => { | |||
| 42 | 42 | const fallbackCss = await metricFallbackCss(family, resolved.fonts, resolved.fallbacks ?? []) | |
| 43 | 43 | const entry = await lookupFamily(family) | |
| 44 | 44 | ||
| 45 | - // Long enough that a hover prefetch and the navigation behind it are one request. | ||
| 46 | - event.res.headers.set('cache-control', 'public, max-age=300, stale-while-revalidate=3600') | ||
| 45 | + /* | ||
| 46 | + * Long enough that a hover prefetch and the navigation behind it are one request, and long | ||
| 47 | + * enough at the edge to answer for a family no provider has republished. A header rather than an | ||
| 48 | + * `isr` route rule: that rewrites the request to a URL carrying no query string, so every | ||
| 49 | + * narrowed facet is answered with the defaults. | ||
| 50 | + */ | ||
| 51 | + event.res.headers.set('cache-control', 'public, max-age=300, s-maxage=86400, stale-while-revalidate=86400') | ||
| 47 | 52 | ||
| 48 | 53 | return { | |
| 49 | 54 | family, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments