aula
aula copied to clipboard
browser-cache for static content
As of #920, browser caching is universally disabled. This is bad for scalability and for people coming through bad networks. What we want is something more like this:
- cache everything under /static
- do not cache anything else
- every reference to a cached resource should end with
[?|&]last_changed=<epoch_time>
we could write a more sophisticated (and much slower) middleware that parses all of html, css, js, and whatever else i forgot, but...
lots of packages on hackage:
- http://hackage.haskell.org/package/wai-middleware-preprocessor more for compiling purescript dynamically on delivery
- http://hackage.haskell.org/package/wai-middleware-etag almost what we want, but doesn't watch file changes
- http://hackage.haskell.org/package/wai-middleware-static-caching probably good for inspiration, but doesn't help with cache busting.
- http://hackage.haskell.org/package/wai-middleware-caching only server-side
- http://hackage.haskell.org/package/wai-static-cache only server-side
- http://hackage.haskell.org/package/wai-middleware-cache only server-side
nothing that does browser cache busting.