Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page loading stucks on header manipulation if page give 302 status code #3973

Closed
khizarsonu opened this issue Feb 9, 2019 · 7 comments
Closed
Labels
bug chromium Issues with Puppeteer-Chromium unconfirmed upstream

Comments

@khizarsonu
Copy link

khizarsonu commented Feb 9, 2019

Steps to reproduce

Tell us about your environment:

  • Puppeteer version:1.12.2
  • Platform / OS version: MAC / UBUNTU
  • URLs (if applicable):
  • Node.js version: 8.11.4
  • chromium command line: ~/node_modules/puppeteer/.local-chromium/linux-624492/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=site-per-process,TranslateUI --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --remote-debugging-port=0 --user-data-dir=/tmp/puppeteer_dev_profile-ria4kq --flag-switches-begin --flag-switches-end --file-url-path-alias=/gen=/home/khizar/solutions2/node_modules/puppeteer/.local-chromium/linux-624492/chrome-linux/gen about:blank
    --

What steps will reproduce the problem?

below code can reproduce this error.

const puppeteer = require('puppeteer');
const URL=require('url').URL;
(async () => {
  let browser = await puppeteer.launch({
    headless:false,
    isMobile:true,
    hasTouch:true,
    args:[
    ]});
  let whiteDomain=['is.gd'];
  let page = await browser.newPage();

  //manipulation of header starts
  await page.setRequestInterception(true);
  await page.setExtraHTTPHeaders(['header1:value2','header2:value2']);
	page.on('request', request => {    
	  // Override headers
    let url=request.url();
    let urlObj=new URL(url);
	  const headers = Object.assign({}, request.headers(), {
	    foo: 'bar', // set "foo" header

	  });
    if(whiteDomain.includes(urlObj.hostname))
    {
      console.log("adding header");
      request.continue({headers});
    }
    else
    {
      request.continue();
    }
    console.log("continue should be called by now");
	});
  //manipulation of header ends;
  await page.goto('http://google.com');
})();

What is the expected result?
header should be manipulated and redirected to other page if page response status code is 302

What happens instead?
page loading forever in pending status

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Feb 10, 2019

Minimum reproducible case: if foo: 'bar' line is commented out, all is OK. If it is uncommented, redirection hangs.

'use strict';

const puppeteer = require('puppeteer');
(async () => {
  try {
    let browser = await puppeteer.launch({ headless: false });
    let [page] = await browser.pages();

    await page.setRequestInterception(true);

    page.on('request', request => {
      const headers = Object.assign({}, request.headers(), {
        // foo: 'bar'
      });
      request.continue({ headers });
    });

    await page.goto('https://is.gd/OwycZW');
  } catch (err) {
    console.error(err);
  }
})();

@ashishnetworks
Copy link

ashishnetworks commented Feb 10, 2019

this is a really annoying bug, did somebody find any workaround or solution for it?

@khizarsonu
Copy link
Author

hi @aslushnikov
can you please look into this bug?

@aslushnikov
Copy link
Contributor

aslushnikov commented Mar 4, 2019

This is a chromium bug; filed upstream as https://crbug.com/937719

Thanks for reporting this!

@aslushnikov aslushnikov added bug upstream chromium Issues with Puppeteer-Chromium labels Mar 4, 2019
aslushnikov added a commit to aslushnikov/puppeteer that referenced this issue Mar 4, 2019
kiku-jw pushed a commit to kiku-jw/puppeteer that referenced this issue Apr 6, 2019
@drsromero
Copy link

I get the same result when I send POST data and the page give 302 status code.

@stale
Copy link

stale bot commented Jun 27, 2022

We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

@stale stale bot added the unconfirmed label Jun 27, 2022
@stale
Copy link

stale bot commented Jul 27, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

@stale stale bot closed this as completed Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug chromium Issues with Puppeteer-Chromium unconfirmed upstream
Projects
None yet
Development

No branches or pull requests

5 participants