diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-21 13:48:42 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-21 13:48:42 +0100 |
commit | c9a0d6d32295303183a895eaa2e55d4be91275f2 (patch) | |
tree | 722214e4ce64fac43787e614342db707b1ab85f5 | |
parent | 49b615210cd1699daaf231508d59915c068dc7f8 (diff) | |
download | gnix-c9a0d6d32295303183a895eaa2e55d4be91275f2.tar gnix-c9a0d6d32295303183a895eaa2e55d4be91275f2.tar.bz2 gnix-c9a0d6d32295303183a895eaa2e55d4be91275f2.tar.zst |
update readme for v2.3.0v2.3.0
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | readme.md | 52 |
3 files changed, 25 insertions, 31 deletions
@@ -586,7 +586,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gnix" -version = "2.1.0" +version = "2.3.0" dependencies = [ "aes-gcm-siv", "anyhow", @@ -1,6 +1,6 @@ [package] name = "gnix" -version = "2.1.0" +version = "2.3.0" edition = "2021" [dependencies] @@ -11,8 +11,7 @@ a simple stupid reverse proxy - Handles connection upgrades correctly by default (websocket, etc.) - TLS support with automatic certificate selection - Configuration hot-reloading -- Client authentification (http basic auth, cookie) -- _TODO: h3; connection pooling_ +- Client authentification (http basic auth, form + cookie) ## Links @@ -25,34 +24,29 @@ a simple stupid reverse proxy 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 +```yaml http: - # the value for 'bind' can either be a string or a list of strings - bind: "[::1]:8080" + bind: "[::]:80" https: - bind: "[::1]:8443" - cert_path: "/etc/letsencrypt/live" # Automatically scans and selects certificates - # tls_cert: "certs/fullchain.pem" - # tls_key: "certs/privkey.pem" + bind: "[::]:443" + cert_path: "/etc/letsencrypt/live" # Scans directory and selects a valid certificate based on hostname -# !hosts multiplexes requests for different hostnames. -handler: !hosts - # requests for `example.org` are forwarded to 127.0.0.1:8000. - "example.org": !proxy { backend: "127.0.0.1:8000" } - # requests for `mydomain.com` will access files from /srv/http. - "mydomain.com": !files - root: "/srv/http" - index: true - # requests for `panel.mydomain.com` will be logged, authentificated and passed on to `otherserver`. - "panel.mydomain.com": !access_log - file: "/var/log/gnix/panel" - next: !cookie_auth - users: "/etc/panel_creds" - expire: 86400 - fail: !file { path: "/usr/share/gnix/login.html" } - next: !proxy { backend: "otherserver:80" } +handler: !hosts # !hosts routes requests for different hostnames. + # requests for `example.org` are forwarded to 127.0.0.1:8000. + "example.org": !proxy { backend: "127.0.0.1:8000" } + # requests for `mydomain.com` will access files from /srv/http. + "mydomain.com": !files + root: "/srv/http" + index: true + # requests for `panel.mydomain.com` will be logged, authentificated and passed on to `otherserver`. + "panel.mydomain.com": !access_log + file: "/var/log/gnix/panel" + next: !cookie_auth + users: "/etc/panel_creds" + expire: 86400 + fail: !file { path: "/usr/share/gnix/login.html" } + next: !proxy { backend: "otherserver:80" } ``` ## Reference @@ -176,7 +170,7 @@ themselves; in that case the request is passed on. client (optional number) - `secure`: makes the cookies accessable from secure contexts exclusively i.e. HTTPS (boolean) - - `next`: a module to handle this request on successfully authentificated. + - `next`: a module to handle this request on successfully authentification. (module) - `fail`: a module to handle the request when a user is not authorized. This could show an HTML form prompting the user to log in. An implementation of @@ -209,8 +203,8 @@ themselves; in that case the request is passed on. - Takes the location to redirect to. (string) - **module `cgi`** - - Runs a CGI script on the request. **This is experimental! Don't use this.** - - `bin`: Path to the CGI binary + - Runs a CGI script on the request. + - `bin`: Path to the CGI binary (string) - `user`: User that the script is executed as. Requires to run gnix as root. (optional string) |