brp / server.js
fekomi8129's picture
Update server.js
55e31a2 verified
raw
history blame contribute delete
546 Bytes
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'] = '207.244.217.165';
return proxyReqOpts;
},
}));
app.listen(port, () => {
console.log(`Reverse proxy server running on ${baseUrl}`);
});