X-Forwarded-For header request replace

572 views Asked by At

I'm making http requests in js for remote server which using amazon cloudfront. I know that cloudfront can add and replace X-Forwarded-For header name with my client ip and proxy, but can I make it after cloudfront or before (jush after that cloudfront couldn't replace my client ip), I know it possibly

const axios = require('axios');
const https = require('https');
const randomUseragent = require('random-useragent');
const proxy = 'your proxy'
function generateRandomUserAgent(ip){
  const headers_search = {
    'user-agent': randomUseragent.getRandom(),
    "Accept": "*/*",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "content-type": "application/json",
    "Authority": "p2p.binance.com",
    "Origin": "https://p2p.binance.com",
    "Pragma": "no-cache",
    "X-Forwarded-For" : ip, ip
  }

  return headers_search
}
const agent = new https.Agent({
  proxy: proxy
});
const responce = axios.post(url, data, {
  headers: generateRandomUserAgent(ip),
  httpsAgent: agent} 
) 
0

There are 0 answers