index : static-web-server.git

ascending towards madness

author Jose Quintana <1700322+joseluisq@users.noreply.github.com> 2022-11-17 15:35:47.0 +00:00:00
committer GitHub <noreply@github.com> 2022-11-17 15:35:47.0 +00:00:00
commit
a09ff1f3e254c564ae001d2a20243a499737cde0 [patch]
tree
243922c9641f0badf929a01c6800f04a3fec5372
parent
0e538dd9572de0e2165f484a84332962b1dee959
download
a09ff1f3e254c564ae001d2a20243a499737cde0.tar.gz

fix: missing `SERVER` prefix for `redirect-trailing-slash` feature (#161)

BREAKING:
this fix is a breaking change only if the previous
`REDIRECT_TRAILING_SLASH` env was used explicitly.
Otherwise, if not set/used (default behavior) then there is no impact.

ADVICE:
we highly encourage users to update `REDIRECT_TRAILING_SLASH` with
`SERVER_REDIRECT_TRAILING_SLASH` for consistency reasons.

Diff

 docs/content/configuration/command-line-arguments.md | 4 ++--
 docs/content/configuration/environment-variables.md  | 2 +-
 src/settings/cli.rs                                  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/content/configuration/command-line-arguments.md b/docs/content/configuration/command-line-arguments.md
index e664248..ede2217 100644
--- a/docs/content/configuration/command-line-arguments.md
+++ b/docs/content/configuration/command-line-arguments.md
@@ -101,7 +101,7 @@ OPTIONS:
    -p, --port <port>                                            Host port [env: SERVER_PORT=]  [default: 80]
        --redirect-trailing-slash <redirect-trailing-slash>
            Check for a trailing slash in the requested directory URI and redirect permanently (308) to the same path
            with a trailing slash suffix if it is missing [env: REDIRECT_TRAILING_SLASH=]  [default: true]
            with a trailing slash suffix if it is missing [env: SERVER_REDIRECT_TRAILING_SLASH=]  [default: true]
    -d, --root <root>
            Root directory path of static files [env: SERVER_ROOT=]  [default: ./public]

@@ -120,7 +120,7 @@ OPTIONS:

## Windows

Following options and commands are Windows platform specific.
The following options and commands are Windows platform specific.

```
 -s, --windows-service <windows-service>
diff --git a/docs/content/configuration/environment-variables.md b/docs/content/configuration/environment-variables.md
index 3cf3741..9fd09ec 100644
--- a/docs/content/configuration/environment-variables.md
+++ b/docs/content/configuration/environment-variables.md
@@ -84,7 +84,7 @@ Enable cache control headers for incoming requests based on a set of file types.
### SERVER_BASIC_AUTH
It provides [The "Basic" HTTP Authentication Scheme]https://datatracker.ietf.org/doc/html/rfc7617 using credentials as `user-id:password` pairs, encoded using `Base64`. Password must be encoded using the [BCrypt]https://en.wikipedia.org/wiki/Bcrypt password-hashing function. Default empty (disabled).

### REDIRECT_TRAILING_SLASH
### SERVER_REDIRECT_TRAILING_SLASH
Check for a trailing slash in the requested directory URI and redirect permanent (308) to the same path with a trailing slash suffix if it is missing. Default `true` (enabled).

## Windows
diff --git a/src/settings/cli.rs b/src/settings/cli.rs
index 5c9ae26..54802eb 100644
--- a/src/settings/cli.rs
+++ b/src/settings/cli.rs
@@ -214,7 +214,7 @@ pub struct General {
        long,
        parse(try_from_str),
        default_value = "true",
        env = "REDIRECT_TRAILING_SLASH"
        env = "SERVER_REDIRECT_TRAILING_SLASH"
    )]
    /// Check for a trailing slash in the requested directory URI and redirect permanently (308) to the same path with a trailing slash suffix if it is missing.
    pub redirect_trailing_slash: bool,