What Is Chrome declarativeNetRequest? The MV3 Request-Modification API Explained
declarativeNetRequest (DNR) is the Chrome extension API, introduced with Manifest V3, that lets an extension block, redirect, upgrade or modify the headers of network requests by registering rules that the browser itself evaluates. The extension never sees the request body, which is good for privacy and speed, but it means DNR cannot change response bodies.
Also called: DNR, chrome.declarativeNetRequest, Manifest V3 network rules
Why Chrome introduced it
In Manifest V2, extensions used blocking webRequest listeners: the browser paused every request and asked the extension's JavaScript what to do. That was flexible but slow and gave extensions full visibility of traffic. Manifest V3 replaced it with DNR: extensions declare rules up front and Chrome applies them natively.
What a DNR rule looks like
{ "id": 101, "priority": 1, "action": { "type": "redirect", "redirect": { "regexSubstitution": "http://localhost:3000\\1" } }, "condition": { "regexFilter": "^https://api\\.example\\.com(/.*)$", "resourceTypes": ["xmlhttprequest"] }}Action types are block, redirect, upgradeScheme, modifyHeaders, allow and allowAllRequests. Rules can be static (shipped in the extension), dynamic (persisted), or session-scoped.
What DNR cannot do
- It cannot read or modify request or response bodies, so no JSON mocking or deep merge.
- It cannot add a delay to a request.
- It cannot make a decision based on anything except URL, domain, method, resource type and similar request metadata.
- Rule counts are capped, and rule IDs and priorities must be managed carefully to avoid collisions.
How ProxyCeptor fills the gaps
ProxyCeptor uses DNR for what it does best (blocking, redirects, non-fetch URL rewrites and header changes) and adds a page-level interceptor for everything DNR cannot do: mocked bodies, JSON deep merge, JavaScript response transforms, request body edits and delays. One rule can use both, and ProxyCeptor rebuilds its DNR rule set whenever you edit a rule.
Frequently asked questions
Can a Manifest V3 extension modify response bodies?
Not with declarativeNetRequest. Extensions that do it inject a script into the page that wraps fetch and XMLHttpRequest, or use the chrome.debugger API. ProxyCeptor uses the page-script approach.
Does declarativeNetRequest work for CORS headers?
DNR modifyHeaders can add or remove response headers such as Access-Control-Allow-Origin, which is often enough to unblock local development. See how to bypass CORS and modify response headers.
Is webRequest still available in Manifest V3?
Yes, for observing traffic, but blocking webRequest is limited to enterprise force-installed extensions. Ordinary extensions must use DNR to change requests.
Keep learning
Intercept your first request in under a minute
Create a free ProxyCeptor account to mock, delay, block and rewrite API traffic, then share the same rules with your team.