Rules
Learn to build Mittelware rules step by step with screenshots, then choose the right action - block, modify request, modify response, stream a response, proxy to another endpoint, pause, or act on WebSocket messages - with a detailed page for each.
A rule is an instruction for Mittelware: when traffic looks like this, then do that. Rules are how you go from watching traffic to changing it, whether that means blocking a request, mocking an API or testing how your app handles a server error.
This page has two halves. First, a step-by-step walkthrough where you build one rule with a screenshot of every field. Then a guide to the actions, with a detailed page for each one: what it does, every setting, and how to try it. In a hurry? Rule templates start you from one of 35 ready-made rules instead of a blank form.
If terms like "request", "status code" or "body" are unfamiliar, read Start here first.
The shape of every rule#
Every rule has the same parts, in the same order on screen:
| Part | What it does |
|---|---|
| Label | A name you will recognise. It's shown in the Rules list and on matching requests in Flows |
| App | Which applications' traffic the rule watches: at least one, and at most five. Traffic from other apps is ignored. For a phone or another computer on your network, choose Network device |
| Type | What the rule is about: HTTP / HTTPS requests and their responses, or WebSocket (ws / wss) connections and their messages. It decides which conditions and actions the form offers. See WebSocket rules |
| Collection | Which collection the rule belongs to. Leave it on Uncategorized if you don't use collections |
| When… | One or more conditions the traffic must match. If you add several, all of them must match |
| Then… | The action to take, chosen in its Action box, and its settings. When an action has several parts, as Modify Request and Modify Response do, each part is its own card, and you can switch a part off without deleting it |
| Finally… | Optional steps that run once the rule has acted, such as keeping a value from a response in a variable. Folded until you need it. See Finally |
| Delay (ms) | Optional, beside Action. Waits this many milliseconds before the action happens. 0 means no wait. Actions that hold or end something on their own (Pause and Review, Drop, Pause and Close) don't show it |
When… and Then… are sections you can fold away by clicking their headers. A folded section keeps a one-line summary, such as 2 conditions or the name of the action, so a long rule stays easy to scan.
The Rules page#
Open Rules in the sidebar to see your rules.

- Import adds the rules from a file that Export wrote. See Export and import rules.
- Export (n) appears once you have ticked rules, and saves just those to a file. To save everything at once, use Settings > Data > Export all data.
- Create Rule is a menu. From template opens the templates panel, and From scratch opens the blank form.
- The checkbox at the start of a row ticks that rule. The one in the table header ticks every rule in the list.
- The switch in the Status column turns a rule on or off. An off rule does nothing but stays saved, which is perfect for rules you only need sometimes.
- The three-dot menu at the end of a row holds more actions for that rule.
Each row shows the icon of the application the rule watches (hover it to read the names, or All apps), the rule's name, its action, its collection, the switch, and when it was last changed. The application filter, the sort button and the search box above the table help when you have many rules.
The panel on the left groups rules into collections, so you can show only some of them, or switch a whole group on or off. The Collection column appears when you are looking at All rules. Collections explains it all. A rule in a collection that is switched off is dimmed, and hovering its switch says why.
Ticking rules#
Tick one or more rules and the bar above the table counts them, with Delete and Move to… buttons. Move to… opens a dialog where you choose a collection to move them to. Delete asks you to confirm, then removes them for good. The Export (n) button at the top of the page counts them too, and exports only those.

- Export (2) exports just the ticked rules.
- The ticked rules.
- The checkbox in the header ticks or unticks every rule in the list.
Changing the application filter or typing in the search box clears the ticks, so you never export rules you can't see.
Build your first rule, step by step#
Goal: whenever Microsoft Edge asks for https://jsonplaceholder.typicode.com/users/1, ignore the server's real answer and return a fake user called Ada Lovelace instead.
This is the same rule as in Getting started. Use any browser you like. Just choose it as the app in step 1.
Before you begin, make sure the browser is opened through Mittelware and monitoring is on.
Step 1: Create the rule and choose the app#
Click Create Rule and choose From scratch. An empty form opens. (From template starts from a ready-made rule instead.) The ? button in the top-right corner, next to Create, shows or hides the About Rules panel, which explains each field as you go. It starts hidden, so the form has the whole window.

- App
- Label
- Type: leave it on HTTP / HTTPS for this walkthrough. WebSocket rules covers the other one.
- When…
- Then…
- ?: shows or hides the About Rules panel.
Label and App sit side by side at the top. Under them, Type and Collection share a row. Leave Collection on Uncategorized for now: Collections explains it.
Click the App box and start typing the name of your browser, for example Edge. The list shows every program Mittelware found on your computer, so typing is the fastest way to find yours. Click it to select it. A rule applies to at least one app and at most five: the box counts them (1/5), and once you have picked five, the others are greyed out until you remove one. There is no "every app" setting; name the apps you want the rule to watch.

You can pick more than one application. The rule then applies to all of them.
Step 2: Give it a label#
In Label, type a name that tells future-you what the rule does: Docs: fake user. Good labels describe the effect ("Block ads", "Mock users API") rather than the technique.
Step 3: Say when it should run#
Under When… click Add Condition. A menu offers every kind of condition, grouped into three columns:

Choose URL. A row appears with three boxes: what to look at, how to compare, and the value. Open the middle box, Operator:

Pick contains, then type jsonplaceholder.typicode.com/users/1 in the value box.

TIP
Prefer contains when you're starting out. It's forgiving: you don't have to type the whole address, and it still matches if the app adds ?page=2 on the end. is wants an exact match of the whole value, so it's easy to miss by a character.
TIP
If you have a real request to match, skip the typing: Import from cURL, next to Add Condition, turns a copied curl command into conditions you tick. See Import conditions from cURL.
Step 4: Say what should happen#
Open the Action box under Then…. It lists the actions, each with a one-line description:

Choose Modify Response. This one decides what comes back to the app. At the top, a Behavior card says how: Instead of the server, the default, answers right here and never contacts the server; the other choice, After the server responds, lets the real request through and edits what comes back. Modify Response covers both. Leave it on Instead of the server.
Below it the list is empty, with an Add action button, because every part is optional. Click Add action to see what you can change:

Choose Body. A card titled Body appears, with a code editor inside. Every part you add is a card like this one: its name in a title bar, with a bin and an eye button at the right end, and its settings below. Leave Raw selected and paste the fake answer:
{"id": 1, "name": "Ada Lovelace", "email": "ada@example.com"}
The finished form looks like this:

- App: only Edge's traffic.
- Label: the name shown in the Rules list.
- When: the URL condition.
- Then: Modify Response, answering Instead of the server.
- The Body card with the new body to return. In its title bar, the bin button removes the part and the eye button switches it off. More on that below.
Leave Delay (ms) at 0.
Step 5: Save it#
Before you save, What will this rule do? under the form opens a side panel that says in plain words what the rule does right now. Then click Create in the top-right corner, or press Ctrl + S (Cmd + S on macOS). The rule is saved and active straight away. There's no restart, and it applies to the very next matching request. You land on the rule's edit view, which has an Enabled switch and a Save button for later changes. Save stays greyed out until you change something.
Step 6: Try it#
In the browser, open this address (the ?demo=1 matters, see the note below):
https://jsonplaceholder.typicode.com/users/1?demo=1
The real server is never asked about this request: Mittelware answers it with your reply, instantly, so it would work with no internet at all. The browser shows your reply:

Now open Flows to see what happened. The row has a shield icon, and its Details panel carries a badge with your rule's name:

WARNING
If the page looks unchanged, the browser probably used its saved copy and never asked. Browsers keep copies of pages, and a page that was loaded before your rule existed can be shown again without any request being made. A request that doesn't happen can't be answered by a rule. Fix it by hard-reloading (Ctrl + Shift + R, or Cmd + Shift + R on macOS), by using a private window, or by adding something like ?demo=1 to the address so it counts as a new page. (With After the server responds, there is a second way to be fooled: the server can answer 304 Not Modified, and the browser then keeps its old copy. See Modify Response.)
Congratulations, you've written a working rule. When you're done, turn it off with the switch on the Rules page, or delete it. Otherwise it will keep answering for that URL.
Choosing an action#
You've now built one rule. Everything else is the same form with a different When… and a different Then…. Each condition and each action has its own page with the full detail.
Conditions (When…)#
A rule runs on traffic that matches all of its conditions. They can look at the URL, the request (method, headers, query parameters, body) or the response (status code, headers, body), using comparisons such as contains, is, starts with, matches regex and is one of. Conditions lists every category and operator, and explains how request and response conditions change which actions you can pick.
Actions (Then…)#
| Action | What it does | Typical use | Details |
|---|---|---|---|
| Block Request / Block Response | Stops the request, or the response, and answers with an error you choose, or with silence | Check your app's error handling and timeouts | Block |
| Modify Request | Changes the request before it is sent: URL, method, headers, query parameters, body | Redirect to your laptop, add a header, send odd input | Modify Request |
| Modify Response | Changes the status, headers or body of the response before your app receives it | Mock an API, fake an error, test a fix | Modify Response |
| Modify Response, Instead of the server | Answers with a mock, a file or a whole folder; the server is never contacted | Build against an endpoint that doesn't exist yet, serve your local build | Answer without the server |
| Modify Response with Find and replace | Edits a few things inside the server's real page or script and leaves the rest alone | Swap a script address, hide a banner | Find and replace |
| No change | Lets traffic through untouched; used for its Finally… rows | Keep a session ID from a login response | Finally and No change |
| Modify Response with a Stream body | Answers with text sent in pieces, like an AI chat API | Build and test a chat screen without a real model | Stream a response |
| Proxy to different endpoint | Replaces the response with one fetched from another URL | Fall back to a test server when the real one answers 404 |
Proxy to endpoint |
| Pause and Review | Holds the request so you can edit it by hand | Debug exactly what is sent, one request at a time | Pause and Review |
| Modify, Drop, Delay, Pause or Close a WebSocket message | Acts on the messages of a WebSocket connection: rewrites, discards, slows or holds one, or ends the connection | Test how a live feed, a chat or a game reacts when a message is odd, late or missing | WebSocket rules |
Not sure which to use? Ask what you want to happen:
- "Make it fail." → Block. A status code, or a timeout.
- "Make it succeed with different data." → Modify Response, or Stream a response if the data should arrive piece by piece. To not involve the server at all, answer instead of the server.
- "Use my local files instead." → serve a folder, or find and replace to swap just one script in a real page.
- "Remember something from this response." → a No change rule with Finally rows, and read it back with variables.
- "Send it somewhere else." → Modify Request for every call, or Proxy to endpoint only when the real answer is, say, a
404. - "Let me look at it and decide." → Pause and Review.
- "It's a live connection, not a request." → a WebSocket rule. Set the Type to WebSocket.
The Delay field#
Every rule has an optional Delay (ms). It waits that many milliseconds before the action happens, whatever the action. It's how you make a response slow: see Test timeouts and slow responses.
Switch a part off without deleting it#
Every card has two buttons at the right end of its title bar. The bin removes the part. The eye switches it off: the part stays in the rule, but its card is dimmed and tagged Disabled, and Mittelware neither checks its values nor applies it to traffic. Click the eye again to switch it back on. It's the quick way to ask "what if I leave this one out?" without retyping it afterwards.
A Headers or Query Param part holds several rows, and each row has its own checkbox. Untick one and that row is dimmed and skipped, while the others still apply.

- The eye button of the Domain part. Click it to switch the part off.
- A header row that is unticked: it stays listed but isn't sent.
- The HTTP Method part, switched off: dimmed, with a Disabled tag.
- On a switched-off part the button shows an open eye. Click it to switch the part back on.
- A rule needs at least one part still switched on. If you switch them all off, saving says Enable at least one modification (Modify Request), Enable at least one of status, headers, or body (Modify Response), or Tick at least one header when every row of a Headers part is unticked.
- A part that is off can hold half-finished values. Only parts that are on have to be valid before you save.
- A part the action can't work without, such as the URL of Proxy to different endpoint, has neither button.
- To stop a whole rule instead, use its switch in the Rules list.
Row menu: make a copy, export, delete#
At the right end of each row in the Rules list, the three-dot menu has these actions. Edit opens the rule, as clicking its row does. The other five are numbered below.

- View flows opens the Flows page showing only the flows this rule acted on. It fills the search box with
rule:="and the rule's name in quotes. - Make a copy opens a dialog with the name
Copy of …ready to confirm. The copy is created switched off and opened for editing, so a copy of a live rule can never act on traffic before you've changed it. Use it to build a variant, such as the same rule with a different status code. - Export saves just this rule to a file. See Export and import rules.
- Move to… opens a dialog with a search box and your collections. Pick one and press Move, and the rule goes to the top of it. See Collections. (It appears once you have made a collection.)
- Delete removes the rule for good, after asking you to confirm. To keep it but stop it running, use the switch in the Status column instead.
Order, and when two rules act on one request#
Rules are checked in the order shown on the Rules page, from the top. With collections, that means the collections in the order their panel lists them (newest first, Uncategorized last), and inside each one its rules, top to bottom. All rules lists them in exactly that order. A request can need two different kinds of help, though: someone to change what is sent, and someone to change what comes back. So up to two rules can act on the same request, one for each job, and the top matching rule wins each job:
| Job | Rules that can do it |
|---|---|
| Change or answer the request | Modify Request, Block Request and Pause and Review: rules whose conditions all look at the request |
| Change the response | Modify Response, and any rule with a response condition, such as Block Response or Proxy to different endpoint |
For example, one Modify Request rule sends calls for api.example.com to your laptop, and one Modify Response rule adds a header to whatever comes back. Both act on the same request, whichever is listed first: the request goes to your laptop, and the answer carries your header. In Flows the request's badge reads 2 rules matched, and hovering it lists them in the order they acted. See Reading the Flows page.
A Modify Response rule with no response condition always matches once the answer arrives, so it wins the response job for every rule listed below it.
Block Request and Pause and Review are the exceptions. A blocked request never gets a real answer, and a paused request is held whole, so there is nothing for a response rule to change. When one of them and a Modify Response rule would both match, the one listed first wins.
Use the switch on any rule to disable it without deleting it.
Limits#
- Streaming responses (
text/event-streamand similar) are followed live, and you can see them chunk by chunk in the Flows Stream view. Because their body isn't captured whole, a Response Body condition can't match them. Status Code and Response Header conditions still can. - Bodies over 32 MB aren't captured, so a Response Body condition can't match them either.
- A WebSocket has no response to match. Its rules use message conditions instead, and apply to the connections opened after the rule is saved.
- HTTPS rules only work once you've trusted the certificate. See HTTPS & certificates.
Share your rules#
Export writes rules to a small JSON file, together with the name of the collection each one is in, and Import adds them back, on the same computer or another one, making any missing collections. That's how you hand a teammate your Hang payments rule, keep a backup before you tidy up, or move rules to a new machine. Export and import rules covers the file, what happens to names that are already taken, and what to check after importing.
Ready-made ideas#
The blog has complete, worked examples:
- Mock an API before it exists
- Simulate a 502 without touching the backend
- Test timeouts and slow responses
- Redirect a production API to localhost
- Rule tricks you'll use every day
- Why developers still need a network interceptor in the AI era
- Serve your local build over a deployed page
- Capture a session ID from a login and use it in every later request
- Keep your rules organised with collections
- See what your phone is sending
In this section
- TemplatesStart a rule from a ready-made template instead of a blank form. Pick one of 35 templates for API failures, slow responses, mocks, streaming replies, WebSocket changes and well-known service errors, fill in the orange blanks, check the plain-words summary and save.
- ConditionsEvery condition and operator a rule can use to decide which traffic it acts on, how several conditions combine, and why request and response conditions change the actions you can choose.
- BlockMake a request or response fail on purpose with a status code of your choice, or time out, to test how your app handles errors and timeouts.
- Modify RequestChange a request before it is sent, including its URL, method, headers, query parameters and body, to redirect it to your laptop, add a token or test what a server does with unusual input.
- Modify ResponseChange the status code, headers or body of a response before your app receives it, or answer instead of the server, to mock an API, fake an error, return unusual data or test a fix without touching the server.
- Answer without the serverAnswer a request yourself with a mock, a file or a whole folder, and never contact the real server. Instant, works offline, and nothing happens on the real server.
- Find and replaceEdit just a few things inside the server's real page or script, such as swapping a script address or hiding a banner, and leave the rest exactly as the server sent it.
- Stream a responseMake a rule answer with a simulated streamed response, word by word like an AI chat API, in plain chunks, Server-Sent Events, OpenAI or Anthropic format, with the pacing you choose.
- Proxy to endpointWhen a real response matches your conditions, fetch the answer from a different URL instead and return that, for example to fall back to a test server when the real endpoint returns a 404.
- Pause and ReviewHold a matching request before it leaves your computer, read it, edit its method, URL, headers or body by hand, then resume it or drop it. A breakpoint for HTTP.
- Export and importSave your rules to a JSON file and load them back, to share them with a teammate, keep a backup or move to another computer, with what the file holds, how names are handled and what to check afterwards.
- FinallyMake a rule do something after the traffic has passed, such as keeping a session ID from a login response in a variable for later rules to use. The No change action lets a rule watch without touching anything.
- CollectionsGroup your rules into collections, switch a whole collection on or off with one click, move rules between them, and decide which collection wins when two have a rule for the same request.