File size: 1,075 Bytes
97b4c9b 5603394 56643f6 5603394 50291f8 97b4c9b 5603394 e2ff3d7 b7bd824 34f7dfc b7bd824 34f7dfc b7bd824 97b4c9b |
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 29 |
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';
const IP = '148.113.165.150';
app.use('/', proxy(targetUrl, {
https: true,
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
//console.log(srcReq);
// Modify the request headers if necessary
proxyReqOpts.headers['x-forwarded-for'] = IP;
proxyReqOpts.headers['x-forwarded-proto'] = 'https';
proxyReqOpts.headers['x-forwarded-host'] = srcReq.headers['host'];
proxyReqOpts.headers['via'] = '1.1 example-proxy';
proxyReqOpts.headers['forwarded'] = `for=${IP};proto=https`;
proxyReqOpts.headers['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36';
proxyReqOpts.headers['referer'] = 'https://www.bing.com/images/create';
return proxyReqOpts;
},
}));
app.listen(port, () => {
console.log(`Reverse proxy server running on ${baseUrl}`);
}); |