From 27170b3454559a128649c41b67dedf9bd712e899 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Sun, 21 Jun 2015 12:05:16 +0000 Subject: [PATCH] Avoid downloading from subsubdomains like ide.newclient-lennnartcl.c9.io Since these don't have a valid certificate, they don't support caching --- plugins/c9.static/unpacked_helper.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/c9.static/unpacked_helper.js b/plugins/c9.static/unpacked_helper.js index dbf551f4..0eb347f6 100644 --- a/plugins/c9.static/unpacked_helper.js +++ b/plugins/c9.static/unpacked_helper.js @@ -17,21 +17,21 @@ function plugin(options, imports, register) { var apiBaseUrl = options.apiBaseUrl; var vfsBaseUrl = options.vfsBaseUrl; - connectStatic.getRequireJsConfig().baseUrlLoadBalancers = [ - ideBaseUrl, + var balancers = [ baseUrl + "/uph", - // We could include others but dogfooding URLs like - // vfs.newclient-lennartcl.c9.io don't have a cert, so - // let's not - // apiBaseUrl + "/uph", - // vfsBaseUrl + "/uph", ]; - assert(connectStatic.getRequireJsConfig().baseUrlLoadBalancers); + if (!options.avoidSubdomains) + balancers.push( + ideBaseUrl + // We could include others but dogfooding URLs like + // vfs.newclient-lennartcl.c9.io don't have a cert, so + // let's not + // apiBaseUrl + "/uph", + // vfsBaseUrl + "/uph" + ); - function cacheForever(req, res, next) { - res.setHeader("Cache-Control", "public, max-age=31556926"); - next(); - } + connectStatic.getRequireJsConfig().baseUrlLoadBalancers = balancers; + assert(connectStatic.getRequireJsConfig().baseUrlLoadBalancers); register(null, { "unpacked_helper": {}