From a0e664fa10254109a64fe6aaef06cd4139a1ef7c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 16 Sep 2014 21:48:54 -0700 Subject: add CORS header this solves some issues with chromecast (see https://github.com/mafintosh/peerflix/pull/113) --- lib/server.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/server.js') diff --git a/lib/server.js b/lib/server.js index 3f85629..9809df7 100644 --- a/lib/server.js +++ b/lib/server.js @@ -15,6 +15,9 @@ module.exports = function Server (webtorrent, port) { server.on('request', function (req, res) { debug('onRequest') + if (req.headers.origin) + res.setHeader('access-control-allow-origin', req.headers.origin) + var u = url.parse(req.url) if (u.pathname === '/favicon.ico') return res.end() if (u.pathname === '/') u.pathname = '/' + webtorrent.index -- cgit v1.2.3