Understanding the Core Principles and Technologies of the hiproxy Proxy Tool
This article explains hiproxy's core proxy mechanisms, including HTTP and HTTPS request handling, automatic certificate generation, plugin architecture, and browser proxy configuration, providing developers with a comprehensive overview of its implementation and extensibility.
hiproxy's core function is request proxying, handling details such as automatic HTTPS certificate generation and browser proxy configuration. The article introduces its basic principles and core technologies.
The HTTP proxy works by receiving GET/POST requests, modifying them according to hosts and rewrite rules, forwarding them to target servers, and returning responses to the client.
For HTTPS, the browser sends a CONNECT request, hiproxy creates a TCP tunnel to the target server, and forwards encrypted data. To modify HTTPS traffic, hiproxy can act as a man‑in‑the‑middle by inserting an additional proxy (M) between hiproxy and the target server.
During the SSL/TLS handshake, the client sends the domain via SNI; the server can generate a domain‑specific certificate using its CA root. hiproxy uses user‑provided certificates when available, otherwise it generates them automatically.
hiproxy offers a simple plugin system: plugins are ordinary npm modules installed globally; hiproxy discovers them at startup and parses extensions for CLI commands, directives, and pages. Example CLI command configuration:
hiporxy hello --name zdying --age 18
Rewrite command example:
add $result 8800 88;
Plugins can also add pages, such as a dashboard for managing hiproxy configuration.
Browser and proxy configuration involves locating the browser executable (e.g., <browser-name>.app on macOS or <path-to-chrome-app>.exe on Windows), launching it with parameters, and specifying either a PAC file ( --proxy-pac-url ) or a direct proxy server ( --proxy-server ). Providing a custom user‑data directory creates an isolated browser instance with its own proxy settings.
The article concludes that readers should now have a solid understanding of hiproxy's implementation and are encouraged to contribute to its development.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.