import httpProxy from 'http-proxy'; // import http from 'http'; const PORT = process.env.PORT || 7860; const DOMAIN = 'https://youtube.com' // // Create your proxy server and set the target in the options. // // httpProxy.createProxyServer({ // target:'http://' + DOMAIN, // }).listen(PORT); httpProxy.createProxyServer({ target: DOMAIN, // secure: true, autoRewrite: true, hostRewrite: true, changeOrigin: true, ws: true, followRedirects: true, }).listen(PORT); // http.createServer(function (req, res) { // res.writeHead(200, { 'Content-Type': 'text/plain' }); // res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2)); // res.end(); // }).listen(9000);