File size: 758 Bytes
0d19f07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);