Any way to allow only whitelisted requests? Or correct way to use setRequestInterceptionEnabled?
See original GitHub issueThe purpose is to allow only whitelisted HTTP requests. I’d like to pass any request to be made to a function and reject/stop any requested URLs that don’t match a simple RegEx.
CDP.version:
{
"Browser": "HeadlessChrome/59.0.3071.104",
"Protocol-Version": "1.2",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/59.0.3071.104 Safari/537.36",
"V8-Version": "5.9.211.35",
"WebKit-Version": "537.36 (@1c037b7399035b4209e72455256615e8972493aa)"
}
Chrome-remote-interface: "chrome-remote-interface": "^0.23.2"
Have tried a couple of methods with dead ends:
- Using
Network.setBlockedURLs({ urls: urlsList })
- good if you know blocking URLs in advance (not in my case). - Using
Network.requestWillBeSent
. Are there any way to block request at this stage? It can easily extract the request information that is needed, but I haven’t found how I could stop the requests from continuing. - Using
Network.enableRequestInterception
from chrome-remote-interface protocol file orNetwork.setRequestInterceptionEnabled
from Chrome DevTools Protocol Viewer - latest (tip-of-tree) with no success and the same errors:Error: 'NetworkAgent.enableRequestInterception' wasn't found
Error: 'Network.setRequestInterceptionEnabled' wasn't found
Even tried sending the same command as aclient.send(method, [params], [callback])
from the docs with no luck.
I’ve stumbled upon this Google Doc explaining that Interception are meant for Blocking and Modifying Network requests so probably the best way would be to use that one and I’m simply not aren’t using it correctly.
Could you specify an example on how to properly use request Interceptions?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Request headers missing after page ... - GitHub
If I set page.setRequestInterceptionEnabled(true); some request headers disappear. Consider the following code: (async() => { const browser ...
Read more >node.js - page.setRequestInterceptionEnabled(true) prevents ...
I'm trying to block some user preference & tracking related requests. The only other solution I could come up, without using ...
Read more >Allow branch whitelist to override "Only build pull requests"
I'd like to enable “Only build pull requests” on a project as all feature branches are PR'ed to master and sent to a...
Read more >How secure is github's whitelisting CORS domains?
The Github API allows you to make requests using CORS [1]. The CORS requests are only allowed by certain whitelisted domains : Any...
Read more >What Is Whitelisting and How Do You Use It? - MakeUseOf
Best of all, they can be implemented for just about anything from emails, applications, IP addresses, and gaming servers. Let us explore the ......
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
Here it is, hope it helps.
@paulirish Is there a public discussion that we can subscribe/bookmark/follow?