declarativeNetRequest.Redirect - Does Safari fully support it?

Hello,

According to MDN, Safari v15.4+ should fully support declarativeNetRequest.Redirect, including regexSubstitution, but when I use it in a rule I get this:

Rule:

EXT_PAGE = '/hello.html';
RULES = [{
  id: 1,
  action: {
    type: 'redirect',
    redirect: {
        regexSubstitution: EXT_PAGE + '#\\0'
    },
  },
  condition: {
    requestDomains: ['example.com'],
    regexFilter: '^.+$',
    resourceTypes: ['main_frame', 'sub_frame'],
  },
}];
browser.declarativeNetRequest.updateDynamicRules({
  removeRuleIds: RULES.map(r => r.id),
  addRules: RULES,
});

Error: Invalid call to declarativeNetRequest.updateDynamicRules(). Error with rule at index 0: Rule with id 1 is invalid. redirect is missing either a url, extensionPath, or transform key.

Answered by bruno.cm in 759550022

Update: Looks like MDN is incorrect, regexSubstitution is only available on Safari v17+

Accepted Answer

Update: Looks like MDN is incorrect, regexSubstitution is only available on Safari v17+

I am using Safari v17+ but still not working for me.

[
    {
        "id" : 1,
        "priority" : 1,
        "action" : { 
            "type" : "redirect",
            "redirect": {
                "regexSubstitution": "xy.abc.net"
            }
        },
        "condition" :
        {
            "regexFilter": "(m\\/)",
            "resourceTypes" : [ "main_frame" ]
        }
    }
]


This is not working but the redirect supports "url" .

I have already added the below permissions.

   "host_permissions": [
      "<all_urls>"
    ],

 "permissions": [ "activeTab", "scripting", "declarativeNetRequestWithHostAccess" ]

Can anyone share some snippet for whom it is working. Am I missing anything?

declarativeNetRequest.Redirect - Does Safari fully support it?
 
 
Q