Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/declarativenetrequest/ruleaction/index.md
6573 views
---
title: declarativeNetRequest.RuleAction slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/RuleAction tags: - API - Add-ons - Extensions - Reference - WebExtensions - Type - declarativeNetRequest - RuleAction browser-compat: webextensions.api.declarativeNetRequest.RuleAction
---

{{AddonSidebar()}}

Details of the action to take if a rule is matched.

Type

Values of this type are objects. They contain these properties:

  • redirect {{optional_inline}}

    • : {{WebExtAPIRef("declarativeNetRequest.Redirect")}}. Describes how the redirect should be performed. Only valid for redirect rules.

  • requestHeaders {{optional_inline}}

    • : {{WebExtAPIRef("declarativeNetRequest.ModifyHeaderInfo")}}. The request headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".

  • responseHeaders {{optional_inline}}

    • : {{WebExtAPIRef("declarativeNetRequest.ModifyHeaderInfo")}}. The response headers to modify for the request. Only valid if RuleActionType is "modifyHeaders".

  • type {{optional_inline}}

    • : A string. The type of action to perform. Possible values are "block", "redirect", "allow", "upgradeScheme", "modifyHeaders", and "allowAllRequests". The use of the "redirect" and "modifyHeaders" actions require host permissions for the request and request initiator. The "block" and "upgradeScheme" actions also require host permissions unless the "declarativeNetRequest" permission is specified. Without these permissions, matching rules are ignored. See Permissions at declarativeNetRequest. for more information.

Browser compatibility

{{Compat}}