A simple stupid reverse proxy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
metamuffin 7bcbf526f3
dont show hidden files
3 weeks ago
src dont show hidden files 3 weeks ago
.gitignore works 2 months ago
COPYING usage and license 2 months ago
Cargo.lock support range requests 1 month ago
Cargo.toml support range requests 1 month ago
readme.md "document" fileserver 1 month ago

readme.md

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 TOML and could look like this:

# Both the [http] and [https] sections are optional
[http]
bind = "127.0.0.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