Update server.js
Browse files
server.js
CHANGED
@@ -8,10 +8,20 @@ const baseUrl = 'bing';
|
|
8 |
app.use('/', proxy(targetUrl, {
|
9 |
https: true,
|
10 |
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
},
|
16 |
}));
|
17 |
|
|
|
8 |
app.use('/', proxy(targetUrl, {
|
9 |
https: true,
|
10 |
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
11 |
+
//console.log(srcReq);
|
12 |
+
// Modify the request headers if necessary
|
13 |
+
proxyReqOpts.headers['x-forwarded-for'] = '51.158.166.131';
|
14 |
+
proxyReqOpts.headers['x-forwarded-proto'] = 'https';
|
15 |
+
proxyReqOpts.headers['x-forwarded-host'] = srcReq.headers['host'];
|
16 |
+
proxyReqOpts.headers['via'] = '1.1 example-proxy';
|
17 |
+
proxyReqOpts.headers['forwarded'] = `for=51.158.166.131;proto=https`;
|
18 |
+
|
19 |
+
// Пример изменения User-Agent
|
20 |
+
proxyReqOpts.headers['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36';
|
21 |
+
// Пример изменения Referer
|
22 |
+
proxyReqOpts.headers['referer'] = 'https://www.bing.com/images/create';
|
23 |
+
|
24 |
+
return proxyReqOpts;
|
25 |
},
|
26 |
}));
|
27 |
|