跳到主要内容
CNode

node.js express 客户端提示需要访问 Rejected because on crossdomain.xml policy file was found.

社区
Mmrchi发布于 13 年前最后回复 13 年前
141560

我用express框架写了一个手机游戏服务器,IOS客户端程序在访问服务端时提示"Rejected because on crossdomain.xml policy file was found." 安卓系统下可以正常访问服务端。求解!!

查看回复

回复 (1)

H
hankwang#113 年前

http://enable-cors.org/server_expressjs.html

app.all('/', function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "X-Requested-With");
  next();
 });

app.get('/', function(req, res, next) {
  // Handle the get for this route
});

app.post('/', function(req, res, next) {
 // Handle the post for this route
});

參考這個

参与回复

登录后即可参与回复。登录