From 0d05c7bf1954579bbf836fb1a309c808df7ab69a Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 17 Oct 2022 13:53:08 -0400 Subject: [PATCH] docs: v2.6.2 changes --- .../markdown/caddyfile/directives/handle_errors.md | 7 +++---- src/docs/markdown/caddyfile/directives/log.md | 14 +++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/docs/markdown/caddyfile/directives/handle_errors.md b/src/docs/markdown/caddyfile/directives/handle_errors.md index ac8de13..8548a01 100644 --- a/src/docs/markdown/caddyfile/directives/handle_errors.md +++ b/src/docs/markdown/caddyfile/directives/handle_errors.md @@ -64,14 +64,13 @@ If you want to provide custom error pages only for some error codes, you can che ```caddy-d handle_errors { - @custom_err file /err-{http.error.status_code}.html /err.html + @custom_err file /err-{err.status_code}.html /err.html handle @custom_err { - rewrite @custom_err {http.matchers.file.relative} + rewrite * {file_match.relative} file_server } - respond "{http.error.status_code} {http.error.status_text}" + respond "{err.status_code} {err.status_text}" } - ``` Reverse proxy to a professional server that is highly qualified for handling HTTP errors and improving your day 😸: diff --git a/src/docs/markdown/caddyfile/directives/log.md b/src/docs/markdown/caddyfile/directives/log.md index 3ab02c1..0b3758a 100644 --- a/src/docs/markdown/caddyfile/directives/log.md +++ b/src/docs/markdown/caddyfile/directives/log.md @@ -155,6 +155,7 @@ format { stacktrace_key line_ending time_format + time_local duration_format level_format } @@ -179,6 +180,7 @@ format { - **wall_nano** Example: `2006/01/02 15:04:05.000000000` - **common_log** Example: `02/Jan/2006:15:04:05 -0700` - Or, any compatible time layout string; see the [Go documentation](https://pkg.go.dev/time#pkg-constants) for full details. +- **time_local** Logs with the local system time rather than the default of UTC time. - **duration_format** The format for durations. May be one of: - **seconds** Floating-point number of seconds elapsed; this is the default. - **nano** Integer number of nanoseconds elapsed. @@ -251,7 +253,11 @@ Marks a field to be replaced with the provided string at encoding time. ##### ip_mask -Masks IP addresses in the field using a CIDR mask, i.e. the number of bits from the IP to retain, starting from the left side. There is separate configuration for IPv4 and IPv6 addresses. Most commonly, the field to filter would be `request>remote_ip`. +Masks IP addresses in the field using a CIDR mask, i.e. the number of bits from the IP to retain, starting from the left side. If the field is an array of strings (e.g. HTTP headers), each value in the array is masked. The value may be a comma separated string of IP addresses. + +There is separate configuration for IPv4 and IPv6 addresses, since they have a different total number of bits. + +Most commonly, the fields to filter would be `request>remote_ip` for the directly connecting client, or `request>headers>X-Forwarded-For` if behind a reverse proxy. ```caddy-d ip_mask { @@ -296,7 +302,7 @@ If many actions are defined for the same cookie name, only the first action will ##### regexp -Marks a field to have a regular expression replacement applied at encoding time. +Marks a field to have a regular expression replacement applied at encoding time. If the field is an array of strings (e.g. HTTP headers), each value in the array has replacements applied. ```caddy-d regexp @@ -308,7 +314,9 @@ In the replacement string, capture groups can be referenced with `${group}` wher ##### hash -Marks a field to be replaced with the first 4 bytes of the SHA-256 hash of the value at encoding time. Useful to obscure the value if it's sensitive, while being able to notice whether each request had a different value. +Marks a field to be replaced with the first 4 bytes (8 hex characters) of the SHA-256 hash of the value at encoding time. If the field is a string array (e.g. HTTP headers), each value in the array is hashed. + +Useful to obscure the value if it's sensitive, while being able to notice whether each request had a different value. ```caddy-d hash