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 redirect rules won’t redirect to extension paths #1

Open
lenacohen opened this issue Feb 27, 2025 · 0 comments
Open

DNR redirect rules won’t redirect to extension paths #1

lenacohen opened this issue Feb 27, 2025 · 0 comments
Labels
DNR Issue with Safari's Declarative Net Request API

Comments

@lenacohen
Copy link
Collaborator

DNR rules redirecting to an extension path lead to an error page: “Safari can’t open the page. The error is: “The operation couldn’t be completed. (NSURLErrorDomain error -1008.)” (NSURLErrorDomain:-1,008).”

This is an example of a redirect rule that leads to an error page instead of the extension path page:

chrome.declarativeNetRequest.updateDynamicRules({addRules: [
    {
        id: 2,
        priority: 1,
        action: {
          type: "redirect",
          redirect: {
            extensionPath: "/web_accessible_resources/test_redirect.html"
          }
        },
        condition: {
            urlFilter: "||washingtonpost.com^",
            resourceTypes: [
                "main_frame"
            ]
        }
      }
]});

The extension path is included in web_accessible_resources in the extension manifest:

      "web_accessible_resources": [{
        "resources": [
          "web_accessible_resources/test_redirect.html"
        ],

Demo Xcode extension: https://github.com/lenacohen/Safari-Test-Extensions/tree/main/dnr-extension-path-redirect
Apple Feedback Assistant Bug Report: FB16607632
Safari version 18.3
MacOS Sequoia 15.3.1

@lenacohen lenacohen added the DNR Issue with Safari's Declarative Net Request API label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNR Issue with Safari's Declarative Net Request API
Projects
None yet
Development

No branches or pull requests

1 participant