w3c / w3c/webextensions

DNR & Proxy

Open
#367 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

topic: dnr
Dominant language
Bikeshed
Stars
711
Forks
95
Avg merge
10d 11h
Merged PRs (30d)
2

Description

The application of declarativeNetRequest on proxies does not appear to have been discussed.

As an example, it can be useful for passing user/pass via headers, as an (easier!?) alternative to webRequest.onAuthRequired.
Note: It might require a special flag/property in DNR to separate it from other requests.

Scenario: Browser -> proxyurl.com -> target.com

It appears that the urlFilter refers to the target.com.

const removeRuleIds = [1];
const addRules = [
  {
    id: 1,
    priority: 1,
    action: {
      type: 'modifyHeaders',
      responseHeaders: [
        {
          header: 'header-1',
          operation: 'set',
          value: 'header1-added'
        }
      ]
    },
    condition: {urlFilter: '||proxyurl.com' }
  }
];

chrome.declarativeNetRequest.updateDynamicRules({removeRuleIds, addRules});

See Also:
Issue 1318138: Add headers using declarativeNetRequest only if the request is being proxied

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue 367 and the linked Chromium issue 1318138. Review how declarativeNetRequest rules are expected to match proxied requests and how header modification should behave in the Browser -> proxyurl.com -> target.com scenario; done requires an agreed specification for proxy handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.