Guide

How to set up HTTPS traffic debugging for your app

Step by step: from installing Microkoi Bench to your first recorded request — from your computer and from your phone — then a collection, a chain, a mock, a mock server, chaos and a monitor.

01 Installation

The beta runs on macOS 13 or later, Windows 10 and 11, and Linux. No sign-up or key needed.

SystemWhat to downloadWhat to do
macOS.dmg imageOpen the image and drag Microkoi Bench into the Applications folder
Windows.exe installerRun the installer and confirm administrator rights: the app is installed in Program Files
Linux.deb or .rpm packageInstall the package with your package manager: sudo apt install ./MicrokoiBench-0.9.6-beta-linux-amd64.deb

The beta is built without paid signing certificates, so on first launch your system warns about an unknown developer. On macOS, right-click the app and choose “Open”; on Windows, click “More info” and “Run anyway”.

02 Workspace

Bench keeps everything about a project in the workspace folder: requests, environments, mocks, notes and recorded traffic. The first launch opens the welcome screen.

ActionShortcutWhat happens
Create workspace⇧⌘NA new folder with the chosen name inside the chosen location
Open folder…⌘OAny folder becomes a workspace; existing files are left untouched
Recent workspace—Opens right away; the list keeps the last twenty

The best place is a folder inside your project repository: collections, environments, mocks, mock servers, monitors and notes go to git, and the traffic database is excluded automatically.

The same actions are in the “File” menu, along with a submenu of recent workspaces and “Close workspace” (⇧⌘W). A workspace opened on this computer for the first time shows a bar with a “Trust workspace” button. Until you click it, mock servers, monitors and the proxy from that workspace do not start on their own.

03 Starting the proxy

Open the “Traffic” section and click “Start”. The proxy comes up on 127.0.0.1, port 9090; you can change the port in settings. To have the proxy start automatically, turn on “Start when a workspace opens” in settings.

All traffic on your computer

SystemWhere to set the proxy
macOS“System Settings” → “Network” → your connection → “Details…” → “Proxies”: turn on “Web proxy (HTTP)” and “Secure web proxy (HTTPS)”, server 127.0.0.1, port 9090
Windows“Settings” → “Network & internet” → “Proxy” → “Manual proxy setup”: address 127.0.0.1, port 9090
LinuxGNOME: “Settings” → “Network” → “Proxy” → “Manual”; KDE: “System Settings” → “Network” → “Proxy”. Address 127.0.0.1, port 9090 for HTTP and HTTPS

Remember to turn off the system proxy after debugging: while Bench is not running, programs that go through it cannot reach the network.

A single program

Many command-line tools and development environments read the proxy address from environment variables. Set them in the terminal before starting the program:

Terminal
export HTTP_PROXY=http://127.0.0.1:9090
export HTTPS_PROXY=http://127.0.0.1:9090

For programs with their own list of trusted certificates, point to the Bench certificate file explicitly. For example, for curl:

Terminal
curl --proxy http://127.0.0.1:9090 \
  --cacert "$HOME/Library/Application Support/Microkoi/Bench/Certificates/microkoi-ca.pem" \
  https://api.example.com/v1/users/me

04 Root certificate for HTTPS

To see the contents of secure connections, you need a root certificate. Bench generates it the first time the proxy is used, and it is unique to your installation. Until the certificate is installed, HTTPS requests show only the host, time and size.

  1. On the Traffic screen, click “Install certificate”.
  2. Confirm the action the way your system asks: with a password, a confirmation dialog or administrator rights.
  3. The Microkoi Bench Root CA certificate appears in the trusted certificate store, and programs start trusting it.
SystemWhere it is addedWhat the system asks for
macOSUser login keychainYour account password
WindowsTrusted Root Certification Authorities of the current userA confirmation dialog; no administrator rights needed
LinuxSystem certificate storeAdministrator rights; without them, Bench shows a ready-made command

On Linux, Bench also adds the certificate to the browser store in ~/.pki/nssdb if certutil from libnss3-tools is installed. If you need system-wide trust, for example for services running as another user, the app shows a ready-made terminal command and a button to check the result.

You can remove the certificate in settings, under “Root certificate”: the “Remove” button takes it out of the system store. Bench always fully verifies connections to real servers. There is no “trust everything” mode.

05 Phones, tablets and emulators

The “Device” button on the Traffic screen opens step-by-step setup. The device sends its traffic to Bench over Wi-Fi, and its exchanges appear in the same list.

  1. Turn on “Allow connections from the local network” in the dialog or in the proxy settings. While connections are allowed, the “Device” button in the Traffic header is green.
  2. In the phone’s Wi-Fi settings, set a manual proxy: the computer’s network address and the port from the dialog. You can copy both.
  3. Scan the QR code or open http://microkoi.cert on the phone. The page has the certificate and instructions for iOS and Android.
  4. Install the certificate and turn on trust for it in the phone’s settings. The Bench dialog shows when the device connects.

The proxy has no authentication, so any device on the network can use it. Allow network connections only on a trusted network and only while debugging, and remove the certificate from the phone afterwards.

  • The Android emulator reaches the computer at 10.0.2.2.
  • The iOS simulator uses the computer’s own network settings.
  • On Android, apps trust a user-installed certificate only if network_security_config in their debug build allows it.

06 Flutter apps

Flutter apps do not use the system proxy, and on Android they also do not trust user-installed certificates. So the app works as usual, but its requests are missing from the traffic list. To see them, set the proxy in the debug build where the HTTP client is created.

  1. In Bench, allow connections from the local network and note the computer’s address and port from the “Device” dialog.
  2. Where the app creates its dio client, set an adapter with the Bench proxy, only in the debug build and only when the proxy address is passed at launch.
  3. Run the app with the proxy address. Requests appear in the Bench traffic list, and the release build stays unchanged.
dio client
import 'dart:io';

import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:flutter/foundation.dart';

const benchProxy = String.fromEnvironment('BENCH_PROXY');

Dio createDio() {
  final dio = Dio(BaseOptions(baseUrl: 'https://api.example.com'));

  if (kDebugMode && benchProxy.isNotEmpty) {
    dio.httpClientAdapter = IOHttpClientAdapter(
      createHttpClient: () => HttpClient()
        ..findProxy = (uri) => 'PROXY $benchProxy'
        ..badCertificateCallback = (certificate, host, port) => true,
    );
  }

  return dio;
}
Run
flutter run --dart-define=BENCH_PROXY=192.168.1.20:9090
  • The Android emulator reaches the computer at 10.0.2.2:9090, the iOS simulator at 127.0.0.1:9090.
  • For HttpClient from dart:io and the http package, the setup is the same: findProxy and badCertificateCallback on the client you pass to IOClient.
  • You do not need to install the certificate on the device: the debug build accepts the Bench certificate by itself.

badCertificateCallback turns off certificate checks, so it lives only in the debug build and only when BENCH_PROXY is set. A stricter option is to trust only the Bench root certificate: download the PEM file from http://microkoi.cert and pass it to SecurityContext.setTrustedCertificatesBytes.

07 Which hosts are recorded

The button with a dot in a frame in the filter bar opens the “Recording” window for the current workspace. The button shows the current rule, such as “All hosts”. A host that is not recorded is not decrypted: the connection goes through an opaque tunnel. That way messengers, mail and apps with certificate pinning keep working while you debug.

ModeWhat is recorded
All hostsAll traffic going through the proxy; the default
Only selectedOnly hosts from the list
All except selectedEverything except hosts from the list
  • api.example.com — this host only
  • *.example.com — the domain itself and all its subdomains
  • You can paste a full URL: https://api.example.com/v1/users becomes api.example.com

08 Inspecting recorded traffic

  • Search covers the URL, headers and text bodies of requests and responses. “Filters” narrow the list by status class from 2xx to 5xx and by first-column icons in the “Show only” group: “Mocks”, “Chaos”, “Model changed”, “JSON in string”.
  • The pause button freezes the list while new exchanges collect in a buffer, with their count shown on the button.
  • Clicking a group in the endpoint tree on the right filters the list; clicking it again clears the filter.
  • The exchange panel at the bottom shows the request and response side by side. Double-click its edge to expand the panel; Esc restores the normal height and then closes it.
  • Copy a response body with one button or save it to a file through the system dialog, in full, even when only the beginning is shown on screen.
  • The “cURL” button copies the recorded request as a terminal command.

09 Breakpoints

A breakpoint holds an exchange: the request before it goes to the server, the response before it reaches the app. While it is held, you can edit it.

  1. Click “Breakpoint” in the exchange panel to set a breakpoint on that method, host and path, for both request and response. Or add a rule in the “Breakpoints” list.
  2. Repeat the action in your app. When the exchange is paused, an editor opens over the screen.
  3. Edit the method, URL, headers and body of the request, or the status code, headers and body of the response.
  4. Click “Continue” (⌘↩), “Continue unchanged” or “Cancel request”. With the last one, the app gets a 502 response.

An exchange waits for your decision for no more than 10 minutes, then continues unchanged. The “Pause exchanges” master switch turns off all breakpoints and releases everything that is held.

10 Chaos: a slow and unstable API

Chaos delays responses, answers with a server error, drops connections and slows the network — following the rules of a profile, with the probability you set. That is how you check how your app survives a bad backend without touching the server or the app.

  1. In “Traffic”, click “Chaos”, then “Create profile”.
  2. Hover over a branch in the “Endpoints” tree, click “⋯” and choose “Chaos” — a rule for the branch opens in the “Chaos” window.
  3. Turn on the block you need, such as “Delay” or “Errors”, and set the probability in its header.
  4. Turn on “Apply chaos” and click “Done”. Exchanges hit by chaos are marked with a lightning bolt in traffic.

Bench always starts with chaos off. While it is on, the window title shows a badge with the profile name, and its cross turns chaos off at once. Each mock server has its own “Chaos” button.

11 Your first request in the API client

  1. In the “Requests” section, click “+” on the tab bar.
  2. Choose a method and enter the URL. The scheme is optional: external hosts use HTTPS, localhost uses HTTP.
  3. Fill in parameters, headers, body and auth on the editor tabs.
  4. Press ⌘↩ to send; press it again to cancel.
  5. Press ⌘S to save the request to a collection.

Any recorded exchange opens in the client with the “To Requests” button, and a whole group of the endpoint tree can be saved as a collection with the button that appears on hover.

You can paste a cURL command right into the URL bar, and the tab fills in with the method, URL, headers and body. The “Import” button above the collection tree opens a command in a new tab, and “Copy as cURL” builds a command from the request with the active environment’s variables filled in. In the same window, an OpenAPI 3 or Swagger 2 specification or a Postman collection becomes a collection folder.

12 Environments and variables

An environment is a named set of variables. Create one in the “Environments” editor and select it on the tab bar. {{name}} is substituted into the URL, parameters, headers, body and auth, and variables can reference each other. A variable that isn’t set is highlighted in red, and typing {{ opens the “Variables” list with names and values.

Example
baseUrl   = {{scheme}}://{{host}}
scheme    = https
host      = api.example.com

GET {{baseUrl}}/v1/orders?requestId={{$uuid}}
VariableValue
{{$timestamp}}Unix time in seconds
{{$isoTimestamp}}UTC time in ISO 8601 format
{{$uuid}}A random UUID
{{$randomInt}}A random number from 0 to 999

The “secret” flag hides a value in the interface but does not encrypt it on disk. If the environment is in a repository, the value goes to git along with it.

13 A request chain

A chain is several collection requests that run in order as one user journey: sign in, list orders, open an order. Values pass between steps through “After response” rules.

  1. Click the arrow next to the “Request” button above the collection tree and choose “New chain”.
  2. Click “Add step” and pick a request — or drag one from the tree onto the flow.
  3. Set expectations in the step properties, and a pause or “Repeat” before the step if the server does not answer right away.
  4. Click “Run” (⌘↩). The bar above the flow shows which step the journey broke on and why.

A chain can be built from recorded traffic: select the exchanges from sign-in to the last screen and choose “Create request chain…”. The “Add to monitoring” button in the chain header puts it on a scheduled check.

14 Mocks

  1. Select an exchange on the Traffic screen and click “Create mock”, or click “+” in the “Mocks” section.
  2. Check the method, host and path. A mock created from traffic starts disabled.
  3. Set the status code, delay, headers and body, then save with ⌘S.
  4. Turn the mock on with its switch. Exchanges answered by mocks are marked in the traffic list.
Path in the ruleWhat matches
/api/users/*/api/users/42, but not /api/users/42/orders
/cdn/**Everything under /cdn
/**/avatar.pngThe avatar.png file at any depth

If several mocks match, the most specific one wins: a path without wildcards beats a path with them, and a set host and method beat “any”. Mocks work only for hosts recorded in the workspace.

Cases

A case is a named subgroup that overrides the status code, headers and body of the original mocks. This way the same endpoints respond differently in different test scenarios.

  1. In the “Mocks” section, click the checkmark button above the tree, check the mocks you need and click “Add to case…”.
  2. Enter a name, for example “Checkout/Delivery slot taken”, and click “Create”. The part of the name before the slash sets the group.
  3. In the override editor, change the status code, headers or body. The original mocks stay as they were.
  4. Click “Make active”: the proxy immediately responds with the case’s responses. “Deactivate” brings back the original responses.

A request is matched against the original mocks, so a case has no paths of its own, and a request without a mock goes to the real server. Cases are stored in the workspace’s cases folder and go to git, while the active case is stored only on your computer.

15 Mock servers

A mock server is a separate API on its own port that your app calls directly, like a backend. Unlike a mock, it works without the proxy.

  1. Hover a host or path group in the traffic tree and click “Create mock server from group”, or click “+” in the “Mock servers” section.
  2. Check the endpoints: each combination of method and path became an endpoint with the last recorded response.
  3. Turn on the “Running” switch. The server starts on a free port, beginning with 9091.
  4. Point your app at the server address, for example http://127.0.0.1:9091, instead of the real API.

If there is no traffic yet, open the “Mock servers” section and pick a template: an online store, food delivery, token authentication and others. The preview shows the endpoints, and the created server behaves like any other.

  • HTTPS works on the same port: the device must trust the Bench root certificate.
  • For a phone, click “Network access” on the server and use the computer’s network address.
  • A request with no matching endpoint gets a 404, and in the “Request log” tab such a request has a “Create endpoint” button.

16 Mock responses in automated tests and CI

The bench-mocks program sits next to the app and runs the same proxy with mock responses, but without a window. It reads the workspace folder and writes nothing to it. When the proxy is ready, the program prints a single JSON line with the addresses and the session token.

Terminal
bench-mocks serve --workspace ./api-space --case "Delivery slot taken"
TaskControl API request
Get the statusGET /v1/status
Activate a casePUT /v1/active-case with the case name
Deactivate the caseDELETE /v1/active-case
Turn off mocksPUT /v1/mocks with {"enabled":false}
Get the reportGET /v1/report
Stop the programPOST /v1/stop

The token is a session secret: do not print the ready line in full to the build log. By default, the proxy listens only on 127.0.0.1, and the --listen 0.0.0.0 option opens it to the whole network without authentication.

17 Monitoring

  1. Click the monitoring icon on a request, folder or chain in the collection tree, “Add to monitoring” in the request or chain editor, or “Monitoring” in the exchange panel. In the “Endpoints” panel on the Traffic screen, use “⋯” → “Add to monitoring” on an endpoint or branch.
  2. Set the interval, from 20 seconds to an hour, and the success conditions: status code, a value at a JSON path, text in the body or a header.
  3. While the app is open, the monitor runs its checks automatically. You get a system notification when it goes down and when it recovers.

“Check all” and the check button on a folder poll many monitors at once, which is handy after a deploy. Every check keeps its request and response: click a row in the “Checks” list to open them below.

18 Notes

In the “Notes” section, the “Note” and “Folder” buttons create items at the root, and the buttons that appear when you hover a folder create them inside it. Notes are plain .md files in the notes folder, and they save automatically.

ShortcutAction
⌘ESwitch between reading and editing
⌘SSave right away without waiting for autosave
⇧⌘FSearch across all notes
⇧⌘KInsert a link to a collection request
⌘B, ⌘IBold and italic; press again to remove the formatting
⌘KTurn the selected text into a link
Tab, ⇧TabIndent and outdent lines

19 Troubleshooting

What happensWhat to do
HTTPS requests show only the hostInstall the certificate with the button on the Traffic screen
The app reports a secure connection errorMost likely it pins its own certificate. Exclude its hosts in the “Recording” window
The proxy does not startAnother program is using the port: choose a different one in settings. Also make sure a workspace is open
A mock does not respondCheck that the proxy is running, the mock is turned on and saved, and its host is recorded in the workspace
The phone cannot reach the network through the proxyCheck that network connections are allowed, the phone and computer are on the same network, and the Wi-Fi settings use the computer’s address, not 127.0.0.1
A CONNECT row with the status “failed”The device does not trust the Bench certificate. Turn on full trust for it and compare the SHA-256 fingerprint with the page at http://microkoi.cert
The app works, but its requests are not in the listIt does not use the system proxy, as is the case with Flutter apps. Set the proxy in the debug build
No network after quitting BenchTurn off the web proxy in your system network settings

Try it on your own project

The beta is free and needs no sign-up. Download it, pick your project folder and start the proxy — your first requests will show up within minutes.

Version 0.9.6 · macOS, Windows and Linux · no sign-up