Middleman is a lightweight, multi-protocol proxy server written in Go using only the standard library. Supports HTTP, HTTPS (via CONNECT), and SOCKS5 protocols.
Middleman is meant for security research and debugging. It is meant to be hackable and customizable. Plugins and such coming soon.
- Multi-Protocol Support: HTTP, HTTPS (CONNECT), and SOCKS5
- Detailed Logging: Logs request details including method, URL, headers, response codes, and timing
- URL Override: Replace remote URLs with local file copies for testing and development
- JSON Configuration: Configure URL overrides via a JSON config file
go build -o middleman main.go
./middleman 4000
./middleman -config config.json 4000
or using the shorthand:
./middleman -c config.json 4000
Create a config.json file to override URLs with local files:
{
"overrides": [
{
"url": "http://example.com/jquery.js",
"local_path": "/path/to/local/jquery.min.js"
},
{
"url": "https://myapp.com/script.js",
"local_path": "/path/to/local/script.js"
}
]
}When a request matches an override URL, Middleman will serve the local file instead of proxying the request. This is useful for:
- Testing with modified versions of libraries
- Debugging minified production code with local unminified versions
- Mocking API responses
- Security research and penetration testing
Middleman provides detailed logging for all requests:
- Timestamp for each operation
- Client addresses
- HTTP method, URL, and protocol version
- Important headers (User-Agent, Host, Content-Type, etc.)
- Response status codes and content length
- Connection timing information
- URL override notifications
Example log output:
[2026-01-31 10:30:45] New connection from 127.0.0.1:54321
[2026-01-31 10:30:45] GET http://example.com/jquery.js HTTP/1.1 from 127.0.0.1:54321
User-Agent: Mozilla/5.0
Host: example.com
[2026-01-31 10:30:45] ✓ URL override: serving http://example.com/jquery.js from local file: /path/to/jquery.js
[2026-01-31 10:30:45] Served local file /path/to/jquery.js (95234 bytes, application/javascript)