From 12e40f089d56d8402c9f1cc00d368cca0b9e6a9e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 2 Aug 2024 13:10:26 +0530 Subject: [PATCH] feat: bypass CSP by setting extra HTTP headers for page context --- maxun-core/src/interpret.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index c7cedc02..bac0150b 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -451,6 +451,11 @@ export default class Interpreter extends EventEmitter { // page.context().addInitScript({ path: path.join(__dirname, 'browserSide', 'scraper.js') }); // } + // Enable CSP bypass for the page + await page.context().setExtraHTTPHeaders({ + 'Content-Security-Policy': '' + }); + this.stopper = () => { this.stopper = null; };