File size: 538 Bytes
97b4c9b
 
 
5603394
56643f6
5603394
97b4c9b
5603394
e2ff3d7
 
afdcff4
 
b1cefb6
afdcff4
97b4c9b
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const express = require('express');
const proxy = require('express-http-proxy');
const app = express();
const targetUrl = 'https://www.bing.com';
const port = 7860;
const baseUrl = 'bing';

app.use('/', proxy(targetUrl, {
	https: true,
    proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
		//console.log(srcReq);
		// Modify the request headers if necessary
		proxyReqOpts.headers['x-forwarded-for'] = '1.1.1.1';
		return proxyReqOpts;
  },
}));

app.listen(port, () => {
  console.log(`Reverse proxy server running on ${baseUrl}`);
});