Dev Proxy plugin for recording HTTP traffic to HAR files using HttpRecorder library. Features streaming HAR file writes with real-time flush and session-based recording. All traffic accumulated in a single HAR file per session.
$ dotnet add package HttpRecorder.DevProxyThis directory contains a Microsoft Dev Proxy plugin that integrates HttpRecorder to capture HTTP traffic and save it as HAR (HTTP Archive) files.
The HttpRecorder Dev Proxy plugin allows you to:
DevProxyExtension/
├── HttpRecorder.DevProxy/
│ ├── HttpRecorderPlugin.cs # Main plugin implementation
│ ├── HttpRecorderPluginConfiguration.cs # Plugin configuration class
│ ├── BasePlugin.cs # Base class stub (replace with DevProxy.Abstractions)
│ └── HttpRecorder.DevProxy.csproj # Project file
├── README.md # This file
└── devproxyrc.example.json # Example Dev Proxy configuration
Microsoft Dev Proxy - Install using winget (recommended):
# Stable version
winget install DevProxy.DevProxy --silent
# OR Beta version (for latest preview features)
winget install DevProxy.DevProxy.Beta --silent
Important: After installation, restart your command prompt to refresh the PATH environment variable.
Alternative: Manual installation from Microsoft Dev Proxy Documentation
.NET 9.0 SDK - Required for building the plugin
When you start Dev Proxy for the first time:
Dev Proxy will display:
info Dev Proxy API listening on http://localhost:8897...
info Dev Proxy Listening on 127.0.0.1:8000...
Hotkeys: issue (w)eb request, (r)ecord, (s)top recording, (c)lear screen
Press CTRL+C to stop Dev Proxy
Important: Always stop Dev Proxy using Ctrl+C to safely unregister it as the system proxy. Closing the terminal without stopping Dev Proxy may cause connection issues.
# From the DevProxyExtension directory
cd HttpRecorder.DevProxy
dotnet build
# The plugin DLL will be at:
# bin/Debug/net9.0/HttpRecorder.DevProxy.dllCreate or update your devproxyrc.json file:
{
"plugins": [
{
"name": "HttpRecorderPlugin",
"enabled": true,
"pluginPath": "./DevProxyExtension/HttpRecorder.DevProxy/bin/Debug/net9.0/HttpRecorder.DevProxy.dll",
"configSection": "httpRecorder"
}
],
"urlsToWatch": [
"https://api.example.com/*",
"https://graph.microsoft.com/*"
],
"httpRecorder": {
"outputDirectory": "./recordings",
"mode": "Record",
"includeBodies": true,
"anonymizeSensitiveData": true,
"sensitiveHeaders": [
"Authorization",
"Cookie",
"Set-Cookie",
"X-API-Key",
"X-Auth-Token"
]
}
}./recordings)true)true)# Start Dev Proxy with your configuration
devproxy --config-file devproxyrc.json
# Or if devproxyrc.json is in the current directory
devproxy
# For beta version
devproxy-beta --config-file devproxyrc.jsonBefore using the plugin, confirm Dev Proxy is intercepting requests:
# Test with Invoke-WebRequest (PowerShell)
Invoke-WebRequest -Uri https://jsonplaceholder.typicode.com/posts
# Or with curl
curl -ikx http://localhost:8000 https://jsonplaceholder.typicode.com/postsYou should see output in the Dev Proxy terminal like:
req ╭ GET https://jsonplaceholder.typicode.com/posts
time │ 1/31/2025 12:12:14 PM +00:00
api ╰ Passed through
urlsToWatch, the BeforeRequestAsync method is calledInteraction object and stores request details (URL, method, headers, body)AfterResponseAsync is calledHttpArchiveInteractionRepositoryEach recorded interaction is saved as a separate HAR file:
recordings/
├── 20251104_143022_1_api_example_com_users.har
├── 20251104_143023_2_api_example_com_orders.har
└── ...
Filenames include:
Note: The current implementation includes a stub BasePlugin.cs class. For production use:
DevProxy.Abstractions.dll.csproj file:<ItemGroup>
<Reference Include="DevProxy.Abstractions">
<HintPath>path/to/DevProxy.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>BasePlugin.cs fileDevProxy.Abstractions namespace# 1. Build the plugin
cd DevProxyExtension/HttpRecorder.DevProxy
dotnet build
# 2. Configure Dev Proxy (edit devproxyrc.json)
# 3. Start Dev Proxy
devproxy
# 4. Configure your application to use the proxy
$env:HTTP_PROXY = "http://localhost:8000"
$env:HTTPS_PROXY = "http://localhost:8000"
# 5. Run your application
# HTTP traffic will be recorded to ./recordings/
# 6. Stop Dev Proxy (Ctrl+C)
# 7. Review HAR files
ls ./recordings/*.harHAR files can be viewed in:
Extend the plugin to add custom anonymization logic:
private void AnonymizeSensitiveHeaders(Dictionary<string, string> headers)
{
// Existing logic...
// Custom: Anonymize API keys in query strings
if (headers.ContainsKey("X-Custom-Header"))
{
headers["X-Custom-Header"] = MaskApiKey(headers["X-Custom-Header"]);
}
}Modify BeforeRequestAsync to add custom filtering:
public override Task BeforeRequestAsync(ProxyRequestArgs e)
{
// Only record POST/PUT requests
if (e.Session.HttpClient.Request.Method != "POST" &&
e.Session.HttpClient.Request.Method != "PUT")
{
return Task.CompletedTask;
}
// Continue with recording...
}pluginPath in devproxyrc.json is correctoutputDirectory has write permissionsurlsToWatch patterns match your requestsincludeBodies: true in configurationThis plugin is part of the HttpRecorder.Next project. See the main README for contribution guidelines.
MIT License - see LICENSE file in the project root.