节点CORS包无法正常工作

时间:2016-07-18 14:30:00

标签: ajax node.js express cors

我在代码中插入了以下几行:

var express = require('express');
var cors = require('cors');

var app = express();

app.options('*', cors());
app.use(cors());

然而,当我发出AJAX POST请求时,我仍然收到错误:

POST https://stormy-plateau-94715.herokuapp.com/login 
new-page-5:1 XMLHttpRequest cannot load https://stormy-plateau-94715.herokuapp.com/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://squareguru.squarespace.com' is therefore not allowed access. The response had HTTP status code 503.

这是我第一次使用cors包,我配置错了吗?我很乐意你们给我的任何帮助,谢谢!

0 个答案:

没有答案