NodeJS CORS与' cors'包

时间:2017-07-31 16:16:52

标签: javascript node.js express cors

我按照' cors'

的文档进行操作

但是当我在测试网页上使用我的网址时。它说cors没有启用。 这是我的代码:

var cors = require('cors');

var options = {
  "origin": "*",
  "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
  "preflightContinue": false,
  "optionsSuccessStatus": 204,
  "credentials" : true
};
app.use(cors(options));

我在邮差中的标题:

Accept-Ranges →bytes
Access-Control-Allow-Credentials →true
Access-Control-Allow-Origin →*
Cache-Control →public, max-age=0
Connection →keep-alive
Content-Disposition →attachment; filename="test.m3u8"
Content-Length →76
Content-Type →application/vnd.apple.mpegurl
Date →Mon, 31 Jul 2017 16:07:43 GMT
ETag →W/"4c-15d990df2d0"
Last-Modified →Mon, 31 Jul 2017 14:30:14 GMT
X-Powered-By →Express

这是一个.m3u8文件,我测试了它:https://bitmovin.com/hls-mpeg-dash-test-player/ https://www.hlsplayer.net

0 个答案:

没有答案