Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/server.js')
-rw-r--r--lib/server.js3
1 files changed, 3 insertions, 0 deletions
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