Skip to content
Advertisement

getting 302 when changing from local host to a proxy in puppeteer + Charles

so am using Charles’s external proxy setting and using puppeteer, the problem is when i put the proxy server in puppeteer as an local host

"--proxy-server=127.0.0.1:8888"

every thing work fine and normally but when i close Charles and use another authenticated proxy the server return a statues of 302 and redirect me, i checked out the headers of the local host and when i change my proxy both are the same

am using this as an header

  await page.setExtraHTTPHeaders({
     "Host": "www.supremenewyork.com",
  "Connection": "keep-alive",
  "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36",
  'Accept':"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  "Sec-Fetch-Site": "same-origin",
  "Sec-Fetch-Mode": "cors",
  "Sec-Fetch-Dest": "empty",
  "Accept": "application/json",
  "Sec-Fetch-User": "1",
  "Sec-Fetch-Dest": "document",
  "referer" :`https://www.supremenewyork.com/mobile/`,
  "Accept-Encoding": " gzip, deflate, br",
  "Accept-Language": " en-GB,en-US;q=0.9,en;q=0.8",
  "Cookie": `${set_cookie}`,
  "dnt": "1",
  "sec-fetch-site" : "same-origin"
},
)

Advertisement

Answer

for some reason the problem was because of proxy authentication, i used proxy-chain and it worked out XD

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement