Skip to content

Commit

Permalink
404 instead of boilerplate on production JS links
Browse files Browse the repository at this point in the history
Make sure the 404 is not cached. Helps with CDNs (see eg 6ff0faa).
  • Loading branch information
glasser committed Aug 31, 2015
1 parent 8b13ffb commit a0162f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/webapp/webapp_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,17 @@ var runWebAppServer = function () {
return undefined;
}

if (request.url.query && request.url.query['meteor_js_resource']) {
// Similarly, we're requesting a JS resource that we don't have.
// Serve an uncached 404. (We can't use the same hack we use for CSS,
// because actually acting on that hack requires us to have the JS
// already!)
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];
Expand Down
2 changes: 1 addition & 1 deletion tools/isobuild/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ class Target {
newFile.setUrlFromRelPath(file.path);
newFile.targetPath = file.path;
} else {
newFile.setUrlToHash('.js');
newFile.setUrlToHash('.js', '?meteor_js_resource=true');
}

return newFile;
Expand Down

0 comments on commit a0162f2

Please sign in to comment.