简体   繁体   中英

XMLHttpRequest cannot load - No 'Access-Control-Allow-Origin' with Meteor & FSCollection

I have some trouble with upload csv file when the app is deployed on Meteor Server. It works on localhost.

I have this error :

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://smsgalaxy.meteor.com ' is therefore not allowed access. The response had HTTP status code 503.

I tried to see the FSCollection documentation. I have read something like don't worry about CORS.

I tried also to add this code in the server side from http://enable-cors.org/server_meteor.html :

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

Doesn't work, alas.

Need help. Thanks.

Ok, I guess Collection FS doesn't work with Meteor deploy... I have read a commentary on Reddit :

All local storage options hinge on https://github.com/CollectionFS/Meteor-CollectionFS which doesn't work with meteor deploy (as far as I know). The way it works is it breaks the file into chunks and stores the binary data in a Mongo FS Collection.

https://www.reddit.com/r/Meteor/comments/2ove4s/how_should_i_handle_file_upload/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM