primary-violetP
Apify & Crawleeโ€ข3y agoโ€ข
4 replies
primary-violet

How to prevent following redirects to other domains?

I see there is a way to prevent this once page loads with something like this:
    await page.setRequestInterception(true);

    page.on('request', async (request) => {
      if (ok) {
        await request.continue();
      } else {
        await request.abort();
      }
    }


But how about when I have a url in queue, is there a nice way to have the request interception setup in the crawler options instead and have it defined globally?
Was this page helpful?