solidusjs / solidus

A simple server that generates pages from JSON and Templates
MIT License
28 stars 7 forks source link

[#ONwaMmbJ] Cache static files for 1 year. #76

Closed joanniclaborde closed 10 years ago

joanniclaborde commented 10 years ago

Branch: ONwaMmbJ-fingerprint-assets

https://trello.com/c/ONwaMmbJ/594-fingerprint-site-assets

Fauntleroy commented 10 years ago

What does this mean for sites that don't use bundles? What will happen in development? Should we set this to zero if the server is being run in development mode, or should we just not set the maxAge at all?

joanniclaborde commented 10 years ago

I moved this value to a config setting called assets_max_age, which defaults to 0 in dev and to 1 year otherwise.

Fauntleroy commented 10 years ago

The only thing that concerns me now are sites that aren't being deployed with our deploy task. Those sites will still be using normal assets, but this max_age, which could be a problem. Is there some way for us to know when a site is being run with fingerprinted assets rather than "normal" ones?

joanniclaborde commented 10 years ago

In this case it would be the developer's responsibility to set the right max age. A default value would be completely arbitrary anyway, for example EdgeCast uses a TTL of 7 days if nothing is specified in the headers.

Or if you think 1 year is too aggressive, we could revert to 1 hour, and change the value in the solidus-site-template initializer.

Fauntleroy commented 10 years ago

Making it configurable sounds like it would solve the issue. We can probably just leave the default at 1 year.