parchment
parchment copied to clipboard
Use versioned subresource URLs with far-future `max-age`
Due to #176, the runtime size of https://iplayif.com/?story=https%3A%2F%2Fifarchive.org%2Fif-archive%2Fgames%2Fzcode%2FLostPig.z8 has increased considerably, so it's more important that we get the caching rules exactly right, like in https://github.com/iftechfoundation/ifarchive-unbox/pull/68
The page loads subresources like https://iplayif.com/dist/web/bocfel.wasm with an unversioned URL, and it's set to Cache-Control: max-age=600, five minutes.
Instead, we should refer to subresources as bocfel.wasm?lastmod=#### and they should return a far-future max-age=31536000, one year
- jquery.min.js
- web.js
- web.css
- iosevka-extended.woff2
- iosevka-extendedbold.woff2
- bocfel.js
- bocfel.wasm
I'm on board with this. For the files in dist/ I'm currently just telling nginx to proxy them to the Github CDN. It would be great if I can detect the lastmod query within nginx and set the max-age, but if necessary we could shift it to the Node app instead.