Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNR & Proxy #367

Open
erosman opened this issue Mar 17, 2023 · 2 comments
Open

DNR & Proxy #367

erosman opened this issue Mar 17, 2023 · 2 comments
Labels
topic: dnr Related to declarativeNetRequest

Comments

@erosman
Copy link

erosman commented Mar 17, 2023

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

@Rob--W Rob--W added topic: dnr Related to declarativeNetRequest and removed needs-triage labels Mar 30, 2023
@Rob--W
Copy link
Member

Rob--W commented Mar 30, 2023

webRequest.onAuthRequired continues to be supported in MV3 (at least in Chrome and Firefox). What would be the value of this functionality in DNR?

@erosman
Copy link
Author

erosman commented Mar 30, 2023

Passing user/pass was only an example. There might!? be occasions where DNR control might be needed for the proxy URL e.g. stripping some headers, or adding cookies, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: dnr Related to declarativeNetRequest
Projects
None yet
Development

No branches or pull requests

2 participants