MarcDiethelm / xtc

This project provides an awesome server and framework for almost any frontend project. It is all about building and running web frontends – and making it easy, efficient and fun.
http://xtc.marcd.ch/
MIT License
16 stars 5 forks source link

feature: add some options for caching / expiration head #76

Open jackblackCH opened 10 years ago

jackblackCH commented 10 years ago

While optimizing my site, I found out that all assets are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers.

It would be nice to set the cache headers somehow (i.e in the a config file).

Currently I added the 'maxAge' value directly in /xtc/app.js. app.use(cfg.staticBaseUri, express.static(cfg.staticPath, { maxAge: 31557600000 }));

Informations about cookies and headers in express here: http://expressjs.com/api.html#res.cookie

MarcDiethelm commented 10 years ago

Starting with version 0.8.0-beta8 you have control over the server from server.js directly in the project root dir. This is the intended place to add your required middlewares (app.use()). No need to go editing in xtc/.

I will look into providing some sensible defaults and options and invalidating them via the dist build tasks. The issue you're describing should not be relevant in development environments.