{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3421","repository_url":"https://api.github.com/repos/GoogleChrome/puppeteer","labels_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3421/labels{/name}","comments_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3421/comments","events_url":"https://api.github.com/repos/GoogleChrome/puppeteer/issues/3421/events","html_url":"https://github.com/GoogleChrome/puppeteer/issues/3421","id":371088693,"node_id":"MDU6SXNzdWUzNzEwODg2OTM=","number":3421,"title":"Page.setRequestInterception Redirection Issue","user":{"login":"Hemant-Mann","id":10141396,"node_id":"MDQ6VXNlcjEwMTQxMzk2","avatar_url":"https://avatars2.githubusercontent.com/u/10141396?v=4","gravatar_id":"","url":"https://api.github.com/users/Hemant-Mann","html_url":"https://github.com/Hemant-Mann","followers_url":"https://api.github.com/users/Hemant-Mann/followers","following_url":"https://api.github.com/users/Hemant-Mann/following{/other_user}","gists_url":"https://api.github.com/users/Hemant-Mann/gists{/gist_id}","starred_url":"https://api.github.com/users/Hemant-Mann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hemant-Mann/subscriptions","organizations_url":"https://api.github.com/users/Hemant-Mann/orgs","repos_url":"https://api.github.com/users/Hemant-Mann/repos","events_url":"https://api.github.com/users/Hemant-Mann/events{/privacy}","received_events_url":"https://api.github.com/users/Hemant-Mann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-17T13:54:40Z","updated_at":"2018-10-17T13:54:40Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nSTEP 1: Are you in the right place?\r\n\r\n- For general technical questions or \"how to\" guidance, please search StackOverflow for questions tagged \"puppeteer\" or create a new post.\r\n\r\nhttps://stackoverflow.com/questions/tagged/puppeteer\r\n\r\n- For issues or feature requests related to the DevTools Protocol (https://chromedevtools.github.io/devtools-protocol/), file an issue there:\r\n\r\nhttps://github.com/ChromeDevTools/devtools-protocol/issues/new.\r\n\r\n- Problem in Headless Chrome? File an issue against Chromium's issue tracker:\r\n\r\nhttps://bugs.chromium.org/p/chromium/issues/entry?components=Internals%3EHeadless&blocking=705916\r\n\r\nFor issues, feature requests, or setup troubles with Puppeteer, file an issue right here!\r\n-->\r\n\r\n### Steps to reproduce\r\n\r\nWhen page.setRequestInterception(true); redirections don't happen correctly\r\n\r\n**Tell us about your environment:**\r\n\r\n* Puppeteer version: 1.7.0\r\n* Platform / OS version: Mac 10.13.6\r\n* URLs (if applicable):\r\n* Node.js version: 8.11.4\r\n\r\n**What steps will reproduce the problem?**\r\n\r\n```js\r\nconst puppeteer = require('puppeteer');\r\n\r\nasync function checkLink() {\r\n\tlet browser = await puppeteer.launch({ headless: true });\r\n\tlet page = await browser.newPage();\r\n\tawait page.setRequestInterception(true);\r\n\tawait page.setUserAgent('Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36');\r\n\tlet redirects = {};\r\n\tpage.on('request', request => {\r\n\t\tif (['image', 'stylesheet', 'font', 'script'].indexOf(request.resourceType()) !== -1) {\r\n\t\t\trequest.abort();\r\n\t\t} else {\r\n\t\t\trequest.continue();\r\n\t\t}\r\n\t});\r\n\tpage.on('requestfailed', (req, resp) => {\r\n\t\tlet failureText = req.failure().errorText;\r\n\t\tif (failureText == 'net::ERR_ABORTED' || failureText == 'net::ERR_UNKNOWN_URL_SCHEME') {\r\n\t\t\tredirects[req.url()] = {\r\n\t\t\t\turl: req.url(),\r\n\t\t\t\tstatus: req.response() ? req.response().status() : 200\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\tpage.on('response', response => {\r\n\t\tlet responseHeaders = response.headers();\r\n\t\tredirects[response.request().url()] = {\r\n\t\t\turl: response.request().url(),\r\n\t\t\tstatus: response.status()\r\n\t\t}\r\n\t})\r\n\ttry {\r\n\t\tconst response = await page.goto('https://demo.vnative.net/5bc72b2fb6920d1c45045435', {\r\n\t\t\ttimeout: 60000,\r\n\t\t\twaitUntil: ['domcontentloaded', 'networkidle0', 'networkidle2']\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.log(e);\r\n\t}\r\n\tawait page.close();\r\n\tawait browser.close();\r\n\treturn redirects;\r\n}\r\n\r\ncheckLink().then(d => console.log(d)).catch(e => console.log(e));\r\n```\r\n\r\n1. Save the code in the file and run it with Node\r\n\r\n**What is the expected result?**\r\n\r\n```js\r\n{ 'https://demo.vnative.net/5bc72b2fb6920d1c45045435':\r\n   { url: 'https://demo.vnative.net/5bc72b2fb6920d1c45045435',\r\n     status: 200 },\r\n  'https://demo.vnative.net/a/v/blue.gif?ps=NDE=&ans=ODY=&cd=SkC2TvBoTprlPg8EQF9h3YrbSekmTEz2hDX3kC3Owft9LfldPd5n8tA4t18A1Ag42-Lb38mb6ZxXb3N0_uC64IaN089hlidkqkVBCbLi-fJ2LzMFtwT2Xlpt--dSmcxZQGjVhxdnZcHNIIir6Z9hSDNkK30eVJHsUixonheL-NokZstGNDAAikkzkg8ZoFJCH3nfVeXrU7X7y2QlYAiKTND0-l1MSAcq55zTzyx5JsW9j0fLgYi53Ssib4E5hkJgLHjGSQyy7fB9n0R9EjDzfLE7cGVlkcVbmaZVRjCaWXK5oAdAO94UqJF1PBg0C0Ss':\r\n   { url: 'https://demo.vnative.net/a/v/blue.gif?ps=NDE=&ans=ODY=&cd=SkC2TvBoTprlPg8EQF9h3YrbSekmTEz2hDX3kC3Owft9LfldPd5n8tA4t18A1Ag42-Lb38mb6ZxXb3N0_uC64IaN089hlidkqkVBCbLi-fJ2LzMFtwT2Xlpt--dSmcxZQGjVhxdnZcHNIIir6Z9hSDNkK30eVJHsUixonheL-NokZstGNDAAikkzkg8ZoFJCH3nfVeXrU7X7y2QlYAiKTND0-l1MSAcq55zTzyx5JsW9j0fLgYi53Ssib4E5hkJgLHjGSQyy7fB9n0R9EjDzfLE7cGVlkcVbmaZVRjCaWXK5oAdAO94UqJF1PBg0C0Ss',\r\n     status: 200 },\r\n  'https://r4i-1.tlnk.io/serve?action=click&agency_id=1371&campaign_id_android=419342&destination_id_android=433748&publisher_id=31&site_id_android=128738&ref_id=102f5382f5969ff81d4ad4d1daa910&sub_publisher=testing_31_&ios_ifa=&google_aid=&sub3=18587&ckey=15102ae1bd15946317d6bc2aa980f00e&data=5bc73d3d7b741c04afc9c39d':\r\n   { url: 'https://r4i-1.tlnk.io/serve?action=click&agency_id=1371&campaign_id_android=419342&destination_id_android=433748&publisher_id=31&site_id_android=128738&ref_id=102f5382f5969ff81d4ad4d1daa910&sub_publisher=testing_31_&ios_ifa=&google_aid=&sub3=18587&ckey=15102ae1bd15946317d6bc2aa980f00e&data=5bc73d3d7b741c04afc9c39d',\r\n     status: 302 },\r\n  'market://details?id=jp.co.atm.vcon.jp&referrer=mat_click_id%3Db77a8e74734a1967b242af01645de275-20181017-15486':\r\n   { url: 'market://details?id=jp.co.atm.vcon.jp&referrer=mat_click_id%3Db77a8e74734a1967b242af01645de275-20181017-15486',\r\n     status: 200 } }\r\n```\r\nThe given URL redirects to a marketplace URI with opened with Android user agent but with Page.setRequestInterception -> true it fails to complete the request\r\n\r\n**What happens instead?**\r\n\r\n```js\r\n{ 'https://demo.vnative.net/5bc72b2fb6920d1c45045435':\r\n   { url: 'https://demo.vnative.net/5bc72b2fb6920d1c45045435',\r\n     status: 200 },\r\n  'https://r4i-1.tlnk.io/serve?action=click&agency_id=1371&campaign_id_android=419342&destination_id_android=433748&publisher_id=31&site_id_android=128738&ref_id=102f5382f5969ff81d4ad4d1daa910&sub_publisher=testing_31_&ios_ifa=&google_aid=&sub3=18587&ckey=15102ae1bd15946317d6bc2aa980f00e&data=5bc73c95be608d04b897e13c':\r\n   { url: 'https://r4i-1.tlnk.io/serve?action=click&agency_id=1371&campaign_id_android=419342&destination_id_android=433748&publisher_id=31&site_id_android=128738&ref_id=102f5382f5969ff81d4ad4d1daa910&sub_publisher=testing_31_&ios_ifa=&google_aid=&sub3=18587&ckey=15102ae1bd15946317d6bc2aa980f00e&data=5bc73c95be608d04b897e13c',\r\n     status: 200 } }\r\n```\r\n\r\nInstead it fails after the second request https://r4i-1.tlnk.io/serve.. which is sending a 302 response with location header `market://details?id=jp.co.atm.vcon.jp..`\r\n\r\nif you comment out the page.setRequestInterception everything works perfectly but unfortunately I need to intercept the requests.\r\n\r\nAny solution / workaround would be appreciated\r\n"}}
{"actor":{"display_login":"Hemant-Mann"}}