# Cannot match multiple declarativeNetRequest rules on the same website on firefox using manifest v3

**URL:** <https://discourse.mozilla.org/t/cannot-match-multiple-declarativenetrequest-rules-on-the-same-website-on-firefox-using-manifest-v3/123306>\
**Category:** Development\
**Tags:** feedback, issue\
**Created:** [October 12, 2023, 10:28am UTC](https://discourse.mozilla.org/t/cannot-match-multiple-declarativenetrequest-rules-on-the-same-website-on-firefox-using-manifest-v3/123306 "2023-10-12T10:28:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lqzhzc](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@lqzhzc](https://discourse.mozilla.org/u/lqzhzc)\
**Post date:** [October 12, 2023, 10:28am UTC](https://discourse.mozilla.org/t/cannot-match-multiple-declarativenetrequest-rules-on-the-same-website-on-firefox-using-manifest-v3/123306/1 "2023-10-12T10:28:46Z")

</div>

## Bug

Core Api docs: [declarativeNetRequest.Rule - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/Rule)

This code is very simple, with only two rules:

1. redirects the website to `?target=t`
2. modifies the website’s request header to add `h2=h2` `h3=h3`

But only 1 or 2 is effective, they cannot both be effective at the same time, while in Chrome, they can be effective simultaneously and work normally.

In `manifest.json`, it is specified that the above rules are only effective for [https://www.amazon.com/\*](https://www.amazon.com/).

> **manifest.json**
>
> ```json
> {
> "manifest_version": 3,
> "name": "test",
> "author": "lqzh",
> "homepage_url": "https://github.com/test",
> "version": "1.0.1",
> "description": "test",
> "permissions": [
> "declarativeNetRequest"
> ],
> "declarative_net_request": {
> "rule_resources": [
> {
> "id": "rules",
> "enabled": true,
> "path": "rules.json"
> }
> ]
> },
> "icons": {
> "16": "./icons/icon_16.png",
> "32": "./icons/icon_32.png",
> "48": "./icons/icon_48.png",
> "128": "./icons/icon_128.png"
> },
> "host_permissions": [
> "https://www.amazon.com/*"
> ],
> "minimum_chrome_version": "101"
> }
> 
> ```

> **rules.json**
>
> ```json
> [
> {
> "id": 1,
> "priority": 1,
> "action": {
> "type": "redirect",
> "redirect": {
> "transform": {
> "queryTransform": {
> "addOrReplaceParams": [
> {
> "key": "target",
> "value": "t"
> }
> ]
> }
> }
> }
> },
> "condition": {
> "urlFilter": "*",
> "resourceTypes": [
> "main_frame",
> "sub_frame",
> "stylesheet",
> "script",
> "image",
> "font",
> "object",
> "xmlhttprequest",
> "ping",
> "csp_report",
> "media",
> "websocket",
> "other"
> ]
> }
> },
> {
> "id": 2,
> "priority": 2,
> "action": {
> "type": "modifyHeaders",
> "requestHeaders": [
> {
> "operation": "set",
> "header": "h2",
> "value": "h2"
> },
> {
> "operation": "set",
> "header": "h3",
> "value": "h3"
> }
> ]
> },
> "condition": {
> "urlFilter": "*",
> "resourceTypes": [
> "main_frame",
> "sub_frame",
> "stylesheet",
> "script",
> "image",
> "font",
> "object",
> "xmlhttprequest",
> "ping",
> "csp_report",
> "media",
> "websocket",
> "other"
> ]
> }
> }
> ]
> 
> ```

> **[firefox.zip](https://drive.google.com/file/d/1O4pGe5Y9t6XrQt7GV_kZ8irAfOYLxAd0/view?usp=drive_link)**
>
> Google Drive file.
