GuideRewrite & network

Headers action (network request layer)

Add, remove or change request / response headers at the browser’s network request layer — for every request type.

The Headers action is executed by the browser (declarativeNetRequest) before the request is sent: the browser adds, removes or changes the configured headers. The real request and response body are untouched.

Headers and Redirect run in the browser’s network request layer, so they cover every request type — fetch, XHR, sub-resources (<script>, <link>, images) and document navigations — and work whether DevTools is open or not.

Operations

OperationEffect
SetAdd the header, or overwrite it when it already exists
AppendAdd another value without removing the existing ones
RemoveDelete the header from the request or the response

Each row has a Target (request or response), a name and, for Set / Append, a value. Rows are independent — one rule can carry both request and response changes.

A common case: unblock a cross-origin API by adding the CORS response headers yourself. The Add CORS response headers button fills in the three standard headers; add Access-Control-Allow-Credentials: true when the call uses cookies.

The rule list summarises header rules as “Request + response headers · 3”.
The rule list summarises header rules as “Request + response headers · 3”.

What it cannot do

  • Change the body, status or delay — use the Mock action for those.
  • Modify browser-protected headers (Host, Content-Length, Cookie in some contexts, and a few Sec-* headers). The rule list marks such a rule as not taking effect, with the reason on hover.
  • Change headers for requests that never reach the browser’s network request layer (a page’s own service worker or an in-memory cache response).
Header rules and Mock rules can both match the same request. The Mock action answers in the page, so its synthetic response never passes through the browser’s network request layer — response-header rules do not apply to it.

Stuck, or need something clarified? support@mockrew.com·Terms of Service