Skip to content

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


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": "",
  "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",
  "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" :``,
  "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"



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