page.on('request') doesn't take header overrides into account when processing redirects (301/302)
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 0.13
- Platform / OS version: any
- URLs (if applicable): https://try-puppeteer.appspot.com/
What steps will reproduce the problem?
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on('response', (response) => {
console.log('RESPONSE RECEIVED');
console.log(response.status + ' ' + response.url);
});
page.on('request', (request) => {
console.log('REQUEST RECEIVED');
console.log(request.url);
request.continue({headers: {'test-header': 'dummy-value'}});
});
await page.goto('http://www.mocky.io/v2/5a427066300000821d709e0f');
//await page.goto('https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending');
await page.screenshot({path: 'screenshot.png', fullPage: true});
await browser.close();
I’ve included the following minimal puppeteer code and 2 sample urls. https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending which is a basic page that returns the HTTP headers sent in the request. And http://www.mocky.io/v2/5a427066300000821d709e0f which returns a 302 to the url specified above.
What is the expected result? Puppeteer should send my custom header in both cases.
What happens instead? Puppeteer doesn’t send the custom header in the request that follows the 301/302. Even though the onRequest event is fired for both the 301 request and the followup request.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
page.on('request') doesn't take header overrides into account when ...
page.on('request') doesn't take header overrides into account when processing redirects (301/302)
Read more >How to manage a redirect request after a jQuery Ajax call
I perform an AJAX request that has 2 possible responses: one that redirects the browser to a new page and one that replaces...
Read more >8. Actions Files - Privoxy
The list of actions files to be used are defined in the main configuration file, and are processed in the order they are...
Read more >HTTP/1.1: Header Field Definitions
The directives specify behavior intended to prevent caches from adversely interfering with the request or response. These directives typically override the ...
Read more >Request Options - Guzzle Documentation
Note: When tracking redirects the X-Guzzle-Redirect-History header will exclude ... Pass an array of HTTP authentication parameters to use with the request.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI this has been fixed in the latest master chromium builds when using
--enable-features=NetworkService
, in case this is a blocking issue for anyone else.Thanks @Glennvd @yujiosaka for the investigation!