javascript - XMLHttpRequest 无法加载 - Meteor 和 FSCollection 没有 'Access-Control-Allow-Origin'

标签 javascript meteor http-status-code-503

当应用程序部署在 Meteor 服务器上时,我在上传 csv 文件时遇到一些问题。它可以在本地主机上运行。

我有这个错误:

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.

我尝试查看 FSCollection 文档。我读过类似“不用担心 CORS”之类的内容。

我还尝试在服务器端添加此代码 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();
});

没用,唉。

需要帮助。谢谢。

最佳答案

好吧,我猜 Collection FS 不能与 Meteor 部署一起使用...我读过 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/

关于javascript - XMLHttpRequest 无法加载 - Meteor 和 FSCollection 没有 'Access-Control-Allow-Origin',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33550290/

相关文章:

javascript - 从 ajax() 成功函数调用外部函数

javascript - 使用 MS Edge 下载 Excel 文件

Meteor.js 谷歌帐户 : filter email and force account choser

node.js - 使用带有 Web Matrix 2 新 Node 支持的 Meteor?

javascript - 从 Meteor 中的事件检索自定义数据属性的最佳方法?

python - 尝试使用 python 访问 Google Patents 时出现 503 错误

jenkins - https ://jenkins. 部分 io 已关闭。我该如何举报?

java - 端点方法不起作用,为什么?

javascript - 图库未显示

javascript - 在不扩展组件的类中更新 React 中的变量