How to use the mirrord Browser Extension for automatic header injection
The mirrord Browser Extension automatically injects an HTTP header into all your browser requests while a mirrord session is running. This solves the hassle of manually adding headers when debugging local services that rely on header-based routing, making it easier to test production-like flows in your browser with zero manual setup.
Before you start, make sure you have:
Header propagation set up in your app.
Google Chrome is installed.
mirrord Browser Extension for Chrome installed.
A valid HTTP header filter defined in your mirrord.json
under feature.network.incoming.http_filter.header_filter
with mode
set to steal
.
Browser extension config enabled in your mirrord.json
.
Note: This feature is experimental.
{
"feature": {
"network": {
"incoming": {
"mode": "steal",
"http_filter": {
"header_filter": "X-My-Header: my-header-value"
}
}
}
},
"experimental": {
"browser_extension_config": true
}
}
Run mirrord exec
with the configured mirrord.json
, mirrord will then:
Prints the configuration URL to the screen.
Opens the URL automatically in a Chrome tab.
The extension injects the active session’s header into all browser requests across tabs.
You can check the current header and status in the extension popup, the extension can be opened anytime from the Chrome extension icon
To stop the extension from injecting HTTP request header, click the extension icon and remove the header from the pop up menu.
The mirrord Browser extenstion will automatically inject the header_filter
defined in mirrord.json
. In case header_filter
configured with regex pattern, you will be prompted in the browser to enter a header that matches it: Please enter a header that matches pattern $HEADER_PATTERN
In case the mirrord browser extension is not downloaded prior to running mirrord exec
with the configured mirrord.json
, the URL will fail to open. Google Chrome will display an error page showing the URL is blocked by Google Chrome.
In case the Browser Extension is enabled in mirrord.json
, but no http header filter is configured, mirrord will not initiate the extension in Google Chrome and display a warning in the terminal.