gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 06:43:59 27 4
gpt4 key购买 nike

当应用程序部署在 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com