Top Related Projects
An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.
HTTP, HTTP2, HTTPS, Websocket debugging proxy
A free utility to help web developers watch and manipulate network traffic from their AJAX applications.
Netty project - an event-driven asynchronous network application framework
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
An HTTP proxy library for Go
Quick Overview
AnyProxy is an open-source web debugging proxy tool developed by Alibaba. It allows users to intercept, analyze, and modify HTTP/HTTPS traffic between clients and servers, making it useful for web development, testing, and security analysis.
Pros
- Cross-platform compatibility (Windows, macOS, Linux)
- Built-in web interface for easy management and traffic analysis
- Supports HTTPS interception with customizable CA certificates
- Extensible through a plugin system for custom functionality
Cons
- Learning curve for advanced features and custom rule development
- Limited documentation for some advanced use cases
- Potential performance impact on high-traffic scenarios
- Requires additional setup for mobile device proxying
Code Examples
- Basic usage to start the proxy server:
const AnyProxy = require('anyproxy');
const options = {
port: 8001,
rule: null,
webInterface: {
enable: true,
webPort: 8002
},
throttle: 10000,
forceProxyHttps: false,
wsIntercept: false,
silent: false
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.on('ready', () => {
console.log('Proxy server is ready');
});
proxyServer.start();
- Implementing a custom rule to modify response:
const rule = {
summary: 'modify response',
*beforeSendResponse(requestDetail, responseDetail) {
if (requestDetail.url.indexOf('example.com') > -1) {
const newResponse = responseDetail.response;
newResponse.body += '<!-- modified by AnyProxy -->';
return { response: newResponse };
}
return null;
},
};
const options = {
// ... other options
rule: rule,
};
const proxyServer = new AnyProxy.ProxyServer(options);
- Using the built-in CA to intercept HTTPS traffic:
const AnyProxy = require('anyproxy');
AnyProxy.utils.certMgr.generateRootCA((error, keyPath) => {
if (!error) {
const options = {
// ... other options
forceProxyHttps: true,
silent: false
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.start();
} else {
console.error('Failed to generate root CA:', error);
}
});
Getting Started
-
Install AnyProxy globally:
npm install -g anyproxy
-
Start the proxy server:
anyproxy
-
Configure your device or browser to use the proxy (default: 127.0.0.1:8001)
-
Access the web interface at http://localhost:8002 to view and analyze traffic
For HTTPS interception, install and trust the AnyProxy root CA certificate on your device or browser.
Competitor Comparisons
An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.
Pros of mitmproxy
- More comprehensive feature set, including a console interface and web interface
- Better support for HTTP/2 and WebSockets
- More active development and larger community
Cons of mitmproxy
- Steeper learning curve due to more complex features
- Requires Python knowledge for scripting and customization
Code Comparison
mitmproxy (Python):
def request(flow):
if flow.request.host == "example.com":
flow.request.headers["Custom-Header"] = "Value"
AnyProxy (JavaScript):
module.exports = {
*beforeSendRequest(requestDetail) {
if (requestDetail.url.indexOf('example.com') > -1) {
requestDetail.requestOptions.headers['Custom-Header'] = 'Value';
}
return requestDetail;
}
};
Summary
mitmproxy offers a more powerful and feature-rich solution for intercepting and modifying HTTP/HTTPS traffic, with better support for modern protocols. It's ideal for advanced users and those comfortable with Python. AnyProxy, on the other hand, provides a simpler JavaScript-based approach, making it more accessible for web developers but with fewer advanced features. Both tools are effective for their intended use cases, with the choice depending on the user's specific requirements and technical background.
HTTP, HTTP2, HTTPS, Websocket debugging proxy
Pros of Whistle
- More comprehensive feature set, including a web-based interface for easier configuration and debugging
- Supports plugins for extended functionality
- Active development with frequent updates and bug fixes
Cons of Whistle
- Steeper learning curve due to more complex configuration options
- May be overkill for simpler proxy needs
- Slightly higher resource usage compared to AnyProxy
Code Comparison
Whistle configuration example:
# whistle.config
/api/ 127.0.0.1:8080
/static/ file:///Users/username/static/
AnyProxy configuration example:
// anyproxy.config.js
module.exports = {
rule: {
summary: 'my rule',
*beforeSendRequest(requestDetail) {
if (requestDetail.url.indexOf('/api/') > -1) {
const newRequestOptions = requestDetail.requestOptions;
newRequestOptions.hostname = '127.0.0.1';
newRequestOptions.port = '8080';
return { requestOptions: newRequestOptions };
}
}
}
};
Both Whistle and AnyProxy are powerful HTTP proxy tools, but Whistle offers a more feature-rich experience with its web interface and plugin system. AnyProxy, on the other hand, provides a simpler approach with JavaScript-based rules, which may be preferable for users who are more comfortable with code-based configuration. The choice between the two depends on the specific requirements of your project and your preferred workflow.
A free utility to help web developers watch and manipulate network traffic from their AJAX applications.
Pros of BrowserMob Proxy
- Written in Java, offering better integration with Java-based projects
- Provides a REST API for easier programmatic control
- Supports HAR (HTTP Archive) file generation out of the box
Cons of BrowserMob Proxy
- Less active development compared to AnyProxy
- Limited support for HTTPS interception without additional configuration
- Fewer built-in features for mobile device proxying
Code Comparison
AnyProxy (JavaScript):
const AnyProxy = require('anyproxy');
const options = {
port: 8001,
rule: require('./rule.js'),
webInterface: {
enable: true,
webPort: 8002
}
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.start();
BrowserMob Proxy (Java):
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
int port = proxy.getPort();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
Both projects serve as HTTP/HTTPS proxies for intercepting and manipulating network traffic. AnyProxy, built with Node.js, offers more flexibility for JavaScript developers and has better support for mobile devices. BrowserMob Proxy, being Java-based, integrates well with Selenium WebDriver and provides built-in HAR generation. The choice between them depends on the specific project requirements and the preferred programming language.
Netty project - an event-driven asynchronous network application framework
Pros of Netty
- More mature and widely adopted project with a larger community
- Higher performance and scalability for network applications
- Supports a broader range of protocols and use cases
Cons of Netty
- Steeper learning curve due to its complexity and extensive features
- Requires more boilerplate code for simple use cases
Code Comparison
AnyProxy (JavaScript):
const AnyProxy = require('anyproxy');
const options = {
port: 8001,
rule: require('./rule.js'),
webInterface: {
enable: true,
webPort: 8002
}
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.start();
Netty (Java):
public class HttpServer {
public static void main(String[] args) throws Exception {
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new HttpServerInitializer());
Channel ch = b.bind(8080).sync().channel();
ch.closeFuture().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
The code examples demonstrate the basic setup for each project. AnyProxy focuses on simplicity for HTTP proxy creation, while Netty provides a more detailed, low-level approach for building network applications.
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
Pros of OkHttp
- More widely adopted and battle-tested in production environments
- Extensive documentation and community support
- Supports modern HTTP/2 and QUIC protocols
Cons of OkHttp
- Limited to Java and Android platforms
- Lacks built-in proxy functionality for intercepting and modifying requests/responses
Code Comparison
OkHttp:
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.example.com")
.build();
Response response = client.newCall(request).execute();
AnyProxy:
const AnyProxy = require('anyproxy');
const options = {
port: 8001,
rule: require('./myRuleModule')
};
const proxyServer = new AnyProxy.ProxyServer(options);
proxyServer.start();
Key Differences
- OkHttp is primarily an HTTP client library, while AnyProxy is a full-featured proxy server
- AnyProxy offers more flexibility for intercepting and modifying HTTP/HTTPS traffic
- OkHttp provides better performance and is more suitable for mobile app development
- AnyProxy is written in JavaScript and runs on Node.js, making it more accessible for web developers
Use Cases
- Choose OkHttp for efficient HTTP client operations in Java/Android applications
- Opt for AnyProxy when you need a customizable proxy server for debugging or modifying network traffic
An HTTP proxy library for Go
Pros of goproxy
- Written in Go, offering better performance and concurrency handling
- Lightweight and easy to integrate into existing Go applications
- Provides low-level control over HTTP/HTTPS traffic manipulation
Cons of goproxy
- Less feature-rich compared to AnyProxy's extensive toolset
- Lacks a built-in web interface for easy configuration and monitoring
- May require more manual coding for advanced use cases
Code Comparison
AnyProxy (JavaScript):
module.exports = {
summary: 'my customized rule for AnyProxy',
*beforeSendRequest(requestDetail) {
if (requestDetail.url.indexOf('example.com') > -1) {
const newRequestOptions = requestDetail.requestOptions;
newRequestOptions.hostname = 'localhost';
return { requestOptions: newRequestOptions };
}
},
};
goproxy (Go):
proxy := goproxy.NewProxyHttpServer()
proxy.OnRequest(goproxy.DstHostIs("example.com")).HandleConnect(goproxy.AlwaysMitm)
proxy.OnRequest().DoFunc(func(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
r.URL.Host = "localhost"
return r, nil
})
Both examples show how to modify requests, but goproxy requires more explicit coding while AnyProxy offers a more declarative approach.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
AnyProxy
AnyProxy is A fully configurable HTTP/HTTPS proxy in NodeJS.
Home page : AnyProxy.io
Issue: https://github.com/alibaba/anyproxy/issues
AnyProxyæ¯ä¸ä¸ªåºäºNodeJSçï¼å¯ä¾æ件é ç½®çHTTP/HTTPS代çæå¡å¨ã
主页ï¼AnyProxy.ioï¼è®¿é®å¯è½éè¦ç¨³å®çå½é ç½ç»ç¯å¢
Legacy doc of version 3.x : https://github.com/alibaba/anyproxy/wiki/3.x-docs
Top Related Projects
An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.
HTTP, HTTP2, HTTPS, Websocket debugging proxy
A free utility to help web developers watch and manipulate network traffic from their AJAX applications.
Netty project - an event-driven asynchronous network application framework
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
An HTTP proxy library for Go
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot