11# vproxy
22
3- > Zero-config virtual proxies with TLS
3+ > Zero-config virtual proxies with TLS, for local development
44
55Automatically create and manage hosts files and TLS certificates for any
66hostname using a locally-trusted CA (via
@@ -18,50 +18,68 @@ brew install vproxy
1818or manually:
1919
20201 . Install [ mkcert] ( https://github.com/FiloSottile/mkcert/#installation )
21- 2 . Build it :
21+ 2 . Download a [ pre-built binary ] ( https://github.com/jittering/vproxy/releases ) or build it from source :
2222
2323``` sh
2424go get github.com/jittering/vproxy/...
2525```
2626
27+ ### Initialize mkcert
28+
29+ Create install a new local-CA in your system:
30+
31+ ``` sh
32+ mkcert -install
33+ ```
34+
2735## Usage
2836
2937vproxy consists of two processes: daemon and client.
3038
3139* The __ daemon__ serves as the primary host of the HTTP & HTTPS endpoints for
3240 your various applications.
3341* The __ client__ registers a service with the daemon and relays all access logs
34- to the current terminal.
42+ to the current terminal. It can also optionally run the service for you.
43+
44+ A single daemon is required per-host, while clients can be run multiple times.
3545
3646### daemon
3747
38- A single daemon is required per-host :
48+ If installed via homebrew on macOS, running it as a service is easy :
3949
4050``` sh
41- $ vproxy daemon
42- [* ] rerunning with sudo
43- Password:
44- [* ] starting proxy: http://127.0.0.1:80
45- [* ] starting proxy: https://127.0.0.1:443
51+ sudo brew services start vproxy
4652```
4753
48- Note that * sudo* is required to bind to privileged ports.
54+ > Note that you must run as root to bind to privileged ports (hence the use of
55+ > sudo above).
4956
50- Alternatively, run it as a homebrew service (macOS only), so it will start
51- automatically:
57+ Or run it manually:
5258
5359``` sh
54- sudo brew services start vproxy
60+ $ vproxy daemon
61+ [* ] rerunning with sudo
62+ Password:
63+ [* ] starting proxy: http://127.0.0.1:80
64+ [* ] starting proxy: https://127.0.0.1:443
5565```
5666
5767### client
5868
69+ Use the client to bind a hostname to a local port:
70+
5971``` sh
6072$ vproxy client --bind foo.local.com:5000
6173[* ] registering vhost: foo.local.com:5000
6274```
6375
64- You can even run the underlying service directly, for ease of use:
76+ The daemon will automatically:
77+
78+ * Issue a TLS cert for ` foo.local.com `
79+ * Add ` foo.local.com ` to your hosts file (e.g., /etc/hosts)
80+ * Add a reverse proxy vhost connecting ` foo.local.com ` to port 5000
81+
82+ You can even run the underlying service with one command, for ease of use:
6583
6684``` sh
6785$ vproxy client --bind foo.local.com:5000 -- flask run
@@ -76,10 +94,12 @@ $ vproxy client --bind foo.local.com:5000 -- flask run
7694```
7795
7896Now visit https://foo.local.com/ to access your application originally running
79- on http://127.0.0.1:8080
97+ on http://127.0.0.1:5000
98+
99+ When you stop the client process (i.e., by pressing ` ^C ` ), vproxy will deregister the vhost with the daemon and send a TERM signal to it's child process.
80100
81101## License
82102
83- MIT, (c) 2020 , Pixelcop Research, Inc.
103+ MIT, (c) 2021 , Pixelcop Research, Inc.
84104
85105Originally based on [ simpleproxy] ( https://github.com/ybrs/simpleproxy ) - MIT (c) 2016 aybars badur.
0 commit comments