Skip to content

Instantly share code, notes, and snippets.

@jacksteamdev
Last active September 1, 2021 15:14
Show Gist options
  • Save jacksteamdev/d9218f0669a9e9f6c595df874754a88c to your computer and use it in GitHub Desktop.
Save jacksteamdev/d9218f0669a9e9f6c595df874754a88c to your computer and use it in GitHub Desktop.
declarativeNetRequest example
{
"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"
}
]
}
}
[
{
"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