Skip to content

Commit

Permalink
Provide reasonable cache-control for fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Feb 9, 2024
1 parent 0fc1031 commit c900c66
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ router.post('/web4/contract/:contractId/:methodName', withNear, withAccountId, r
if (!e.toString().includes('does not exist while viewing')) {
debug('Error checking access key', e);
throw e;
}
}

debug('Access key not found, falling back to wallet');
}
Expand Down Expand Up @@ -444,7 +444,8 @@ router.get('/(.*)', withNear, withContractId, withAccountId, async ctx => {
ctx.set('cache-control', cacheControl);
} else {
// Set reasonable defaults based on content type
if (ctx.type.startsWith('image/') || ctx.type.startsWith('video/') || ctx.type.startsWith('audio/') ||
if (ctx.type.startsWith('image/') || ctx.type.startsWith('font/') ||
ctx.type.startsWith('video/') || ctx.type.startsWith('audio/') ||
ctx.type === 'application/javascript' || ctx.type === 'text/css' ) {
// NOTE: modern web apps typically have these static with a unique URL, so can cache for a long time (1 hour)
ctx.set('cache-control', 'public, max-age=3600');
Expand Down

0 comments on commit c900c66

Please sign in to comment.