blob: 7f62cb60c823634875e3cb5d4edde45334bfa3ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# gnix
a simple stupid reverse proxy
## Features
- Simple to configure (see below)
- Handles connection upgrades correctly by default (websocket, etc.)
- TLS support
- _TODO: h2; match on uris; connection pools_
## Usage
Run the binary with the a path to the configuration as the first argument. The
configuration file is written in YAML and could look like this:
```toml
# Both the 'http' and 'https' sections are optional
http:
# the value for 'bind' can either be a string or a list of strings
bind: [ "127.0.0.1:8080", "[::1]:8080" ]
https:
bind: "127.0.0.1:8443"
tls_cert: "ssl/cert.pem"
tls_key: "ssl/key.pem" # only accepts pkcs8 for now
# this is a lookup table from hostnames to backend address
# in this case, requests for `testdomain.local` are forwarded to 127.0.0.1:3000
hosts:
testdomain.local: { backend: "127.0.0.1:3000" }
secondomain.local: { backend: "1.2.3.4:5678" }
static.testdomain.local: { files: { root: "/srv/http", index: true } }
```
The configuration can either be specify a backend to forward to or the `files`
key. In that case, static files are served from `root` and directory listings
will be generated if `index` is true (default). If a directory contains
`index.html` the listing is replace with that file. If `index.banner.html`, it's
content is inserted before the listing.
# License
AGPL-3.0-only; see [COPYING](./COPYING)
|