Skip to content

Commit abde724

Browse files
committed
Tune wildcards
1 parent 417be31 commit abde724

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/server.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ app.get('/users/:user', (req, res) => {
230230

231231
// These files' names contain a hash of their content, so they can be cached forever.
232232
app.get([
233-
'{*splat}/js/*splat',
234-
'{*splat}/static/assets/*splat'
233+
'{*_}/js/*_',
234+
'{*_}/static/assets/*_'
235235
], (req, res, next) => {
236236
// File names contain hash of content, can cache forever.
237237
res.header('Cache-Control', 'public, max-age=315360000, immutable');
@@ -240,28 +240,28 @@ app.get([
240240

241241
// These files could change but they are reasonably hot and very rarely will change
242242
app.get([
243-
'{*splat}/static/blocks-media/*splat',
244-
'{*splat}/favicon.ico',
245-
'{*splat}/manifest.webmanifest',
246-
'{*splat}/images/*splat',
243+
'{*_}/static/blocks-media/*_',
244+
'{*_}/favicon.ico',
245+
'{*_}/manifest.webmanifest',
246+
'{*_}/images/*_',
247247
// Our sw.js is just a stub; if we actually used it then we would want to not list it here
248-
'{*splat}/sw.js',
249-
'{*splat}/robots.txt',
250-
'{*splat}/.well-known/*splat',
248+
'{*_}/sw.js',
249+
'{*_}/robots.txt',
250+
'{*_}/.well-known/*_',
251251
], (req, res, next) => {
252252
res.header('Cache-Control', 'public, max-age=604800, immutable');
253253
next();
254254
});
255255

256-
app.get('*splat', (req, res, next) => {
256+
app.get('{*_}', (req, res, next) => {
257257
// Ask browsers to revalidate all files that aren't explicitly cached
258258
if (res.getHeader('Cache-Control') === undefined) {
259259
res.header('Cache-Control', 'no-cache');
260260
}
261261
next();
262262
});
263263

264-
app.get('/{*splat}', async (req, res, next) => {
264+
app.get('/{*_}', async (req, res, next) => {
265265
let pathName = req.path;
266266
let projectId = null;
267267
let projectMeta = null;

0 commit comments

Comments
 (0)