3 ms·
You can modify headers and block requests.
by vbezhenar 6y ago
You can modify headers and block requests.
- rasz 6y agoGreat news, please share how.
- vbezhenar 6y agohttps://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/ https://developer.chrome.com/docs/extensions/reference/decla... Snippet from rules.json: { "id": 1, "priority": 1, "action": { "type": "block" }, "condition": {"urlFilter": "google.com", "resourceTypes": ["main_frame"] } }, { "id": 11, "priority": 1, "action": { "type": "modifyHeaders", "responseHeaders": [ { "header": "h1", "operation": "set", "value": "v4" }, { "header": "h2", "operation": "append", "value": "v5" }, { "header": "h3", "operation": "append", "value": "v6" } ] }, "condition": { "urlFilter": "headers.com/12345", "resourceTypes": ["main_frame"] } },
- rasz 6y agoLast time I looked Google position was: "Regarding which headers will be allowed, we'll look at the feedback from devs and the current metrics and decide. In general, we want to take a closer look at the security implications of header modification." tldr: CSP modification was strictly forbidden. Digging in further it seems this changed somewhere in 2020 and appears to be working now https://bugs.chromium.org/p/chromium/issues/detail?id=1116487 https://bugs.chromium.org/p/chromium/issues/detail?id=111648...