Skip to content
This repository has been archived by the owner. It is now read-only.

Merge in fixes for cache control #873

Merged
merged 3 commits into from Apr 17, 2014
Merged
Changes from all commits
Commits
File filter
Filter file types
Beta Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -72,7 +72,9 @@ function makeApp() {

// workaround for reserved word bug:
// https://github.com/marijnh/acorn/issues/85
app.use(express['static'](STATIC_DIRECTORY));
app.use(express['static'](STATIC_DIRECTORY, {
maxAge: config.get('static_max_age')
}));

// it's a four-oh-four not found.
app.use(fourOhFour);
@@ -2,6 +2,7 @@
"fxaccount_url": "https://api-accounts.dev.lcip.org",
"static_directory": "dist",
"page_template_subdirectory": "dist",
"static_max_age" : 0,
"i18n": {
"supportedLanguages": ["af", "an", "ar", "as", "ast", "be", "bg", "bn-BD", "bn-IN", "br", "bs", "ca", "cs", "cy", "da", "de", "el", "en-GB", "en-US", "en-ZA", "eo", "es", "es-AR", "es-CL", "es-MX", "et", "eu", "fa", "ff", "fi", "fr", "fy", "fy-NL", "ga", "ga-IE", "gd", "gl", "gu", "gu-IN", "he", "hi-IN", "hr", "ht", "hu", "hy-AM", "id", "is", "it", "it-CH", "ja", "kk", "km", "kn", "ko", "ku", "lij", "lt", "lv", "mai", "mk", "ml", "mr", "ms", "nb-NO", "ne-NP", "nl", "nn-NO", "or", "pa", "pa-IN", "pl", "pt", "pt-BR", "pt-PT", "rm", "ro", "ru", "si", "sk", "sl", "son", "sq", "sr", "sr-LATN", "sv", "sv-SE", "ta", "te", "th", "tr", "uk", "ur", "vi", "xh", "zh-CN", "zh-TW", "zu"]
}
@@ -7,6 +7,7 @@
},
"env": "development",
"use_https": false,
"static_max_age" : 0,
"i18n": {
"supportedLanguages": ["af", "an", "ar", "as", "ast", "be", "bg", "bn-BD", "bn-IN", "br", "bs", "ca", "cs", "cy", "da", "de", "el", "en-GB", "en-US", "en-ZA", "eo", "es", "es-AR", "es-CL", "es-MX", "et", "eu", "fa", "ff", "fi", "fr", "fy", "fy-NL", "ga", "ga-IE", "gd", "gl", "gu", "gu-IN", "he", "hi-IN", "hr", "ht", "hu", "hy-AM", "id", "is", "it", "it-CH", "ja", "kk", "km", "kn", "ko", "ku", "lij", "lt", "lv", "mai", "mk", "ml", "mr", "ms", "nb-NO", "ne-NP", "nl", "nn-NO", "or", "pa", "pa-IN", "pl", "pt", "pt-BR", "pt-PT", "rm", "ro", "ru", "si", "sk", "sl", "son", "sq", "sr", "sr-LATN", "sv", "sv-SE", "ta", "te", "th", "tr", "uk", "ur", "vi", "xh", "zh-CN", "zh-TW", "zu"]
},
@@ -90,10 +90,10 @@ var conf = module.exports = convict({
format: String,
default: 'app'
},
font_max_age_ms: {
doc: 'Cache fonts for this amount of time, in ms',
static_max_age: {
doc: 'Cache max age for static assets, in ms',
format: Number,
default: 180 * 24 * 60 * 60 * 1000 // 180 days
default: 180 * 24 * 60 * 60 * 1000
},
hsts_max_age: {
doc: 'Max age of the STS directive, in seconds',
@@ -13,6 +13,9 @@ module.exports = function(i18n) {
route.path = '/config';

route.process = function(req, res) {
// `language` and `cookiesEnabled` are dynamic so don't cache.
res.header('Cache-Control', 'no-cache, max-age=0');

// Let any intermediaries know that /config can vary based
// on the accept-language. This will also be useful if client.json
// gains long lived cache-control headers.
ProTip! Use n and p to navigate between commits in a pull request.