Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require("http");
- http.createServer(onRequest).listen(5010);
- function onRequest(client_req, client_res) {
- //console.log("Got request: " + client_req.url);
- var requestURL = client_req.url.split("?url=")[1];
- var options = {
- path: requestURL,
- //method: "GET"
- method: client_req.method
- };
- var proxy = http.request(options, function (res) {
- client_res.writeHead(200, {'Content-Type': res.headers['content-type']});
- res.pipe(client_res, {
- end: true
- });
- });
- client_req.pipe(proxy, {
- end: true
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement