Support query parameter to avoid downloading index page when a file does not exist

When downloading files during a Cordova hot code push, we need to
detect if a file is not available instead of inadvertently downloading
the default index page.
This commit is contained in:
Martijn Walraven
2016-01-07 14:36:49 +01:00
parent 0a31dabcd6
commit 21ee605541

View File

@@ -685,6 +685,17 @@ var runWebAppServer = function () {
return undefined;
}
if (request.url.query && request.url.query['meteor_dont_serve_index']) {
// When downloading files during a Cordova hot code push, we need
// to detect if a file is not available instead of inadvertently
// downloading the default index page.
// So similar to the situation above, we serve an uncached 404.
headers['Cache-Control'] = 'no-cache';
res.writeHead(404, headers);
res.end("404 Not Found");
return undefined;
}
// /packages/asdfsad ... /__cordova/dafsdf.js
var pathname = connect.utils.parseUrl(req).pathname;
var archKey = pathname.split('/')[1];