Reputation: 103
I am using puppeteer to bring up chromium and launch a page. For my scenario the page URL has to be intercepted along with the css/js/img requests coming from the page.
My puppeteer code for page interception looks like this,
await page.setRequestInterception(true);
page.on("request", async (request: HTTPRequest) => {
if (request.url().endsWith(".html") ||
request.url().endsWith(".js") ||
request.url().endsWith(".css") ||
request.url().endsWith(".png")) {
let redirectUrl = await getNewUrl(request.url());
request.continue({ url: redirectUrl });
} else {
request.continue();
}
}
All the browser requests return an error looking like this,
I am still new to puppeteer and chrome extension development, kindly let me know if any way to figure out the issue here.
Upvotes: 2
Views: 1773
Reputation: 19
I am also suffering from same issue but I have a solution for this issue. If you are using ajax method and give static url path so remove this path and fix from dynamic path.
Upvotes: 0