From ef1ed0beb17649e7c65eee7081c605282bae8111 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 11 Nov 2024 14:54:15 +0100 Subject: paths rest capture group --- readme.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 4817493..53f54f5 100644 --- a/readme.md +++ b/readme.md @@ -58,7 +58,8 @@ handler: !hosts ## Reference The configuration uses YAML formatting. When the configuration file is changed, -it will automatically be loaded and applied if valid. +it will automatically be loaded and applied if valid. Configuration errors are +reported in stderr and are only fatal at startup. - **section `http`** - Optional section. Omit to disable unencrypted http. @@ -86,7 +87,7 @@ it will automatically be loaded and applied if valid. connections. excess connections are rejected. Default: 256 - **section `handler`** - - A module to handle all requests. Usually an instance of `hosts`. + - A module to handle all requests. Usually an instance of `hosts` or `paths`. - `watch_config`: boolean if to watch the configuration file for changes and apply them accordingly. Default: true (Note: This will watch the entire parent @@ -103,14 +104,17 @@ themselves; in that case the request is passed on. - Takes a map from hostname (string) to handler (module) - **module `paths`** - - Routes requests by matching the path against regexes. - - Takes a map from a global regex that is applied to the path (string) to - handler (module) + - Routes requests by matching the path against regexes. The first matching + regex determines the module to handle this request. If the regex has an + unnamed capture group, its value will become the downstream request URI. + - Takes a map from regex (string) to handler (module) OR a sequence of such + maps. The priority is assigned first by position in the sequence then + alphabetically in the map. - **module `proxy`** - Forwards the request as-is to some other server. the `x-real-ip` header is - injected into the request. Connection upgrades are handled by direct - forwarding of network traffic. + added to the request. Connection upgrades are handled by direct forwarding + of network traffic. - `backend`: socket address (string) to the backend server - **module `files`** @@ -127,8 +131,8 @@ themselves; in that case the request is passed on. - **module `file`** - Replies with static content. - - `path`: file path to the content. _This will be loaded into memory once!_ - (string) + - `path`: file path to the content. _This will be loaded into memory at + startup!_ (string) - `content`: inline declaration of the content. (string) - `type`: type of content reflected in `content-type` header. (string) -- cgit v1.2.3-70-g09d2