If you are willing to help hiproxy to write documentation, please contact firstname.lastname@example.org, thank you!
Hiproxy can use hosts to make simple request proxy. And
rewrite can be used for complex configuration rules which use similar syntax of Nginx.
It has same syntax as
hosts of OS. As additinal, it supports configurating port number. You can only configure host with corresponding IP and port in hosts. It does not support detailed routing and modification to request/response. Read hosts for more.
You can make complex configuration in rewrite in some complex situation. That includes detailed routing, and modification to request/response. The syntax of rewirte configuration is very similar to that of Nginx. Read rewrite for more.
# global variables
hiproxy recommends you place configuration files in the particular project root directory (hosts file named
hosts and rewrite file named
rewrite). Projects are placed in workspace so that the hierarchy structure is line below:
The benifit is that these configuration files can be commit to code repository for sharing with team members, and cost saving. Furthermore, hiproxy can find the files by itself.
If you follow the rules above to place the files (with their special names), and hiproxy use
workspace directory as workspace, it can find the configuration files of the three projects without spcifying by manual.
If you do NOT follow the rules, place the files to different directory or not use default names (
hosts for hosts file and
rewrite for rewrite file), you have to specify the files while hiproxy starts.
Read Find Configuration File for more.
Hiproxy support two proxy methods: PAC(Proxy-Auto-Config) and general proxy.
General proxy method is default one. You can use
--pac-proxy for swithing to PAC while starting.
The Deifferent proxy methods deal updating configuration file in different way.
If it’s running in general proxy mode and the configuration file was updated. You can just refresh the browsing page to make it valid.
But if it’s running in PAC proxy mode, and one or more new domain ware added. You should refresh the browser’s proxy file by manual since the
.pac file is not updated immediately. If you want detail, you can visit chrome://net-internals/#proxy then click
The rules in all configuration files should be merged into a bit rules tree. That is, after configuring the proxy, all the rules in the configuration files are equal at the time the request is processing. The rules in different domain would not affect each other. The rules in the same domain should be merged and later rule should overwrite previous one if they are same route.
For example, there are two configuration files,
workspace/docs/rewrite. Their content are below:
# merged rules