Created
July 20, 2015 13:24
-
-
Save reepush/2f364ce3e4d52f61f0bb to your computer and use it in GitHub Desktop.
CORS proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express') | |
| var request = require('request') | |
| var app = express() | |
| app.get('/', function(req, res) { | |
| var src = req.query.src | |
| res.header('Access-Control-Allow-Origin', '*') | |
| if (!src) { res.send(''); return } | |
| options = { | |
| url: src, | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0', | |
| } | |
| } | |
| request(options, function(err, response, body) { | |
| res.send(body) | |
| }) | |
| }) | |
| app.listen(3000, function() { | |
| console.log('Listening on 3000 port...') | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment