如何在meteor上允许Access-Control-Allow-Origin

时间:2015-11-12 02:32:08

标签: javascript meteor cors

我的问题如下:

我使用HTTP.method创建了cfs:http-methods,问题是我无法接收来自其他客户的帖子...

我正在使用this site来测试cors,错误如下:

XMLHttpRequest cannot load http://www.easydelivery.net.br/pagseguroNotifications.
The 'Access-Control-Allow-Origin' header has a value 'http://meteor.local'
that is not equal to the supplied origin.
Origin 'http://client.cors-api.appspot.com' is therefore not allowed access.

我的方法仍然很简单,我希望能够先连接完成它,所以这里是:

HTTP.methods({
  '/pagseguroNotifications': function() {
    console.log(this.request);
  }
});

Meteor.startup(function() {
  // Listen to incoming HTTP requests, can only be used on the server
    console.log('chamou');
  WebApp.connectHandlers.use(function(req, res, next) {
    res.setHeader("Access-Control-Allow-Origin", "*");
    return next();
  });
});

0 个答案:

没有答案