【发布时间】:2019-04-28 14:33:20
【问题描述】:
我有一个在 gh-pages https://yourweatherapp.github.io/yourweatherapp.github.io 中运行的 Angular 应用程序,它向它在主机中运行的 node.js 应用程序发出请求。
以前,我曾在网上查阅过类似How to allow CORS? 的其他信息,但解决方案对我不起作用
我已将 node.js 应用程序配置为以这种方式允许来自此来源的请求:
const corsMiddleware = cors({
origin: [process.env.URL, 'https://yourweatherapp.github.io/yourweatherapp.github.io/login']
})
app.use(corsMiddleware)
app.options('*', corsMiddleware)
但浏览器不允许接收答案并登录。
我做错了什么?
【问题讨论】:
标签: node.js angular cors github-pages