From 85dbc186c23fabdd0797882a84ac55dad18be7a1 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 17 Jun 2021 14:12:48 -0600 Subject: [PATCH] docs: Minor updates to file_server and reverse_proxy --- src/docs/markdown/caddyfile/directives/file_server.md | 7 ++++--- src/docs/markdown/caddyfile/directives/reverse_proxy.md | 4 ++-- src/docs/markdown/command-line.md | 4 ++-- src/resources/css/chroma.css | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/docs/markdown/caddyfile/directives/file_server.md b/src/docs/markdown/caddyfile/directives/file_server.md index 191b09b..dfabf30 100644 --- a/src/docs/markdown/caddyfile/directives/file_server.md +++ b/src/docs/markdown/caddyfile/directives/file_server.md @@ -4,7 +4,9 @@ title: file_server (Caddyfile directive) # file_server -A static file server. It works by appending the request's URI path to the [site's root path](/docs/caddyfile/directives/root). By default, it enforces canonical URIs; if necessary, requests to directories will be redirected to have a trailing forward slash, and requests to files will be redirected to strip the trailing slash. +A static file server. It works by appending the request's URI path to the [site's root path](/docs/caddyfile/directives/root). + +By default, it enforces canonical URIs; meaning HTTP redirects will be issued for requests to directories that do not end with a trailing slash (to add it) or requests to files that have a trailing slash (to remove it). Redirects are not issued, however, if an internal rewrite modifies the last element of the path (the filename). Most often, the `file_server` directive is paired with the [`root`](/docs/caddyfile/directives/root) directive to set file root for the whole site. @@ -26,8 +28,7 @@ file_server [] [browse] { - **hide** is a list of files or folders to hide; if requested, the file server will pretend they do not exist. Accepts placeholders and glob patterns. Note that these are _file system_ paths, NOT request paths. In other words, relative paths use the current working directory as a base, NOT the site root; and all paths are transformed to their absolute form before comparisons (if possible). Specifying a file name or pattern without a path separator will hide all files with a matching name regardless of its location; otherwise, a path prefix match will be attempted, and then a globular match. Since this is a Caddyfile config, the active configuration file(s) will be added by default. - **index** is a list of filenames to look for as index files. Default: `index.html index.txt` - **** is an optional custom template file to use for directory listings. Defaults to the template that can be found [here in the source code ![external link](/resources/images/external-link.svg)](https://github.com/caddyserver/caddy/blob/master/modules/caddyhttp/fileserver/browsetpl.go). Browse templates can use actions from [the standard templates module](/docs/modules/http.handlers.templates#docs) as well. -- **precompressed** is the list of encoding formats to search for precompressed sidecar files. -- **<formats...>** is the ordered list of encoding formats to search for precompressed sidecar files. Supported formats are `gzip`, `zstd` and `br`. +- **precompressed** is the list of encoding formats to search for precompressed sidecar files. Arguments are an ordered list of encoding formats to search for precompressed sidecar files. Supported formats are `gzip`, `zstd` and `br`. - **status** is an optional status code override to be used when writing the response. Particularly useful when responding to a request with a custom error page. Can be a 3-digit status code, For example: `404`. Placeholders are supported. By default, the written status code will typically be `200`, or `206` for partial content. ## Examples diff --git a/src/docs/markdown/caddyfile/directives/reverse_proxy.md b/src/docs/markdown/caddyfile/directives/reverse_proxy.md index 1dae180..40936e2 100644 --- a/src/docs/markdown/caddyfile/directives/reverse_proxy.md +++ b/src/docs/markdown/caddyfile/directives/reverse_proxy.md @@ -204,10 +204,10 @@ transport http { tls_server_name keepalive [off|] keepalive_idle_conns + keepalive_idle_conns_per_host versions compression off max_conns_per_host - max_idle_conns_per_host } ``` @@ -226,10 +226,10 @@ transport http { - **tls_server_name** sets the ServerName (SNI) to put in the ClientHello; only needed if the remote server requires it. - **keepalive** is either `off` or a [duration value](/docs/conventions#durations) that specifies how long to keep connections open. - **keepalive_idle_conns** defines the maximum number of connections to keep alive. +- **keepalive_idle_conns_per_host** if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. Default: `32` - **versions** allows customizing which versions of HTTP to support. As a special case, "h2c" is a valid value which will enable cleartext HTTP/2 connections to the upstream (however, this is a non-standard feature that does not use Go's default HTTP transport, so it is exclusive of other features; subject to change or removal). Default: `1.1 2`, or if scheme is `h2c://`, `h2c 2` - **compression** can be used to disable compression to the backend by setting it to `off`. - **max_conns_per_host** optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. Has no limit by default. -- **max_idle_conns_per_host** if non-zero, controls the maximum idle (keepalive) connections to keep per-host. Default: `2` diff --git a/src/docs/markdown/command-line.md b/src/docs/markdown/command-line.md index d2aa7c6..160349e 100644 --- a/src/docs/markdown/command-line.md +++ b/src/docs/markdown/command-line.md @@ -45,7 +45,7 @@ The ellipses `...` indicates a continuation, i.e. one or more parameters. Changes the config of the running Caddy process - **[caddy reverse-proxy](#caddy-reverse-proxy)** - A simple but production-ready reverse proxy + A simple but production-ready HTTP(S) reverse proxy - **[caddy run](#caddy-run)** Starts the Caddy process in the foreground @@ -246,7 +246,7 @@ Because this command uses the API, the admin endpoint must not be disabled. --to <addr> [--change-host-header] -Spins up a simple but production-ready reverse proxy. +Spins up a simple but production-ready HTTP(S) reverse proxy. `--from` is the address to proxy from. diff --git a/src/resources/css/chroma.css b/src/resources/css/chroma.css index 852e326..193432e 100644 --- a/src/resources/css/chroma.css +++ b/src/resources/css/chroma.css @@ -25,11 +25,11 @@ .chroma .cp { color: #577b00 } /* Comment.Preproc */ .chroma .c1 { color: #93a1a1 } /* Comment.Single */ .chroma .cs { color: #577b00 } /* Comment.Special */ -.chroma .gd { color: #008076 } /* Generic.Deleted */ +.chroma .gd { color: #dc322f; background-color: #efdede } /* Generic.Deleted */ .chroma .ge { color: #586e75; font-style: italic } /* Generic.Emph */ .chroma .gr { color: #dc322f } /* Generic.Error */ .chroma .gh { color: #d03d00 } /* Generic.Heading */ -.chroma .gi { color: #577b00 } /* Generic.Inserted */ +.chroma .gi { color: #577b00; background-color: #ddecdc } /* Generic.Inserted */ .chroma .go { color: #586e75 } /* Generic.Output */ .chroma .gp { color: #586e75 } /* Generic.Prompt */ .chroma .gs { color: #586e75; font-weight: bold } /* Generic.Strong */ @@ -103,7 +103,7 @@ .chroma .cp { color: #76a507 } /* Comment.Preproc */ .chroma .c1 { color: #586e75 } /* Comment.Single */ .chroma .cs { color: #76a507 } /* Comment.Special */ - .chroma .gd { color: #09a598 } /* Generic.Deleted */ + .chroma .gd { color: #dc322f; background-color: #efdede } /* Generic.Deleted */ .chroma .ge { color: #93a1a1; font-style: italic } /* Generic.Emph */ .chroma .gr { color: #dc322f } /* Generic.Error */ .chroma .gh { color: #ec662e } /* Generic.Heading */