Rules
A rule is a set of configurations that tell tweak how to intercept and modify a request. Every rule starts with the same two things (a url expression to match and an HTTP method) and then differs in what it does once a request matches.
There are four rule types, and the one you pick decides everything else about the rule: which fields you get, which requests it can reach, and whether it needs tweak to be running.

When to use each rule type?β
| Rule type | Use it when⦠| Plan |
|---|---|---|
| Mock | The endpoint does not exist yet, is broken, is slow, you want a fixed answer you fully control or you simply don't care about the real server response | Free |
| Modify | You want the real response, or a slightly modified version of it, with a few things changed: one field, the status code, a header. | Paid |
| Headers only | If only the headers matter for you. | Free for response headers, paid for request headers |
| Redirect | The request should go somewhere else entirely: a local server, a different version of the API, a fixture. | Free, unless you want to target specific assets (e.g. only images) |
Capabilities break downβ
Mock and Modify run inside the page: tweak wraps fetch and
XMLHttpRequest, so they see exactly what your JavaScript asks for, and nothing else. Headers only and
Redirect are applied by the browser itself, so they see every request, including ones your code never
makes.
| Mock Β· Modify | Headers only Β· Redirect | |
|---|---|---|
| Applied by | tweak, inside the page | the browser itself |
| Reaches Fetch / XHR | β | β |
| Reaches page navigations, scripts, images, stylesheets, fonts | β | β |
| Can rewrite the response body | β | β |
| Can run hooks and debugging tools | β | β |
| Works when tweak is stopped | β | β , with the Global scope |
| Available on Firefox | β | β |
| Counts intercepted requests | β | β |
| Known limitations | service workers, document bodies | Chrome only, no body rewriting |
Common scenariosβ
| I want to⦠| Rule type |
|---|---|
| Build a screen against an API that is not ready yet | Mock |
Reproduce a 500, a timeout, or an empty list | Mock |
| Demo the app offline | Mock |
| Change one field of a real response and keep the rest | Modify |
| Keep the real response but override its status code | Modify |
| Rewrite the outgoing request payload before it is sent | Modify |
| Add an auth or feature-flag header to every API call | Headers only |
Strip Content-Security-Policy from a page so it loads in an iframe | Headers only |
Set a cookie on the response, or append a second Set-Cookie | Headers only |
Point the production API at http://localhost:3000 | Redirect |
| Swap a bundled script or stylesheet for a local build | Redirect |
| Break an image on purpose, or swap it for a very large one | Redirect |
Move /v1/ calls onto /v2/ without touching the app | Redirect |
The anatomy of a ruleβ
Below, a rule on the free plan.

Below, a rule on a paid plan.

The fields shared by every rule type are covered in the introduction. What each type adds on top is covered in its own section:
- Mock and modify rules: payload, status, delay, headers, hooks
- Headers only rules: the header table, operations and scope
- Redirect rules: where the request goes instead
Need something else? Request a feature