Last active
September 1, 2021 15:14
-
-
Save jacksteamdev/d9218f0669a9e9f6c595df874754a88c to your computer and use it in GitHub Desktop.
declarativeNetRequest example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"background": { | |
"service_worker": "service_worker.ts" | |
}, | |
"content_scripts": [ | |
{ | |
"js": ["content.ts"], | |
"matches": ["https://www.google.com/*"] | |
} | |
], | |
"options_page": "options.html", | |
"manifest_version": 3, | |
"permissions": [ | |
"storage", | |
"declarativeNetRequest", | |
// feedback only needed for dev move | |
"declarativeNetRequestFeedback" | |
], | |
// host permissions are required | |
"host_permissions": ["http://*/*", "https://*/*"], | |
// loads ruleset | |
"declarative_net_request": { | |
"rule_resources": [ | |
{ | |
"id": "esm-content-scripts", | |
"enabled": true, | |
"path": "rpce-ruleset.json" | |
} | |
] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 1, | |
"priority": 1, | |
"action": { | |
"type": "modifyHeaders", | |
"responseHeaders": [ | |
{ | |
"header": "content-security-policy", | |
"operation": "set", | |
"value": "script-src 'self' http://localhost:2000; object-src 'self' http://localhost:2000" | |
}, | |
{ | |
"header": "Content-Security-Policy", | |
"operation": "set", | |
"value": "script-src 'self' http://localhost:2000; object-src 'self' http://localhost:2000" | |
} | |
] | |
}, | |
"condition": { | |
"urlFilter": "*", | |
"resourceTypes": ["main_frame"] | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment