Revert "Use Meteor.absoluteUrl again in dynamic-import fetchMissing function."

This reverts commit 3b77bb5197.

Should fix #9888.

Sending dynamic import() requests to any origin other than location.host
causes some browsers to send a preflight CORS request ( method:OPTIONS) to
verify that the server allows the request, which was causing problems
because the dynamic import() server expects method:POST.
This commit is contained in:
Ben Newman
2018-05-14 10:52:12 -04:00
parent 903cd3c8b9
commit 6c91a4f0c3

View File

@@ -121,7 +121,11 @@ var fetchURL = require("./common.js").fetchURL;
function fetchMissing(missingTree) {
return new Promise(function (resolve, reject) {
HTTP.call("POST", Meteor.absoluteUrl(fetchURL), {
// Always match the protocol (http or https) and the domain:port of
// the current page.
var url = "//" + location.host + fetchURL;
HTTP.call("POST", url, {
query: secretKey ? "key=" + secretKey : void 0,
data: missingTree
}, function (error, result) {