It removes `public` from `Cache-Control` value, leaving max-age=<VALUE>, which can prevent CDN and Basic Authentication issues. See details on #560.
This applies to the "Cache-Control Headers" feature, with no user-breaking changes expected.
- `sws.toml` used if present
- But `config.toml` has priority if it exists
- A warning message is printed if `config.toml` is used, as it will be removed in a future release previous advice.
- BREAKING: End support for unmaintained Windows 7, 8, 8.1 platforms as previously announced on v2.36.1.
- SECURITY (RUSTSEC-2024-0437): Crash due to uncontrolled recursion in protobuf crate was temporarily solved in the previous release. However, this PR applies the dependency patches recently available.
- RESTORED: `experimental` Cargo feature for metrics and in-memory cache.
This PR adds support for controlling ANSI escape codes for colors and other text formatting when logging via a new boolean --log-with-ansi CLI option and its equivalent SERVER_LOG_WITH_ANSI env.
No ANSI by default:
Note that from now on, SWS will be no-ansi by default. If you want colored log output, then use --log-with-ansi.
For example:
```
static-web-server -p 8788 -d ./public/ -g trace -z --log-with-ansi
```
* refactor: prevent single wildcards from matching path separators for URL Rewrites
* Fix log output in documentation
BREAKING CHANGE: Up to version 2.33.1 the wildcard `*` was matching the path separator. For example, `/{*}/{*}/` matched `/assets/images/logo/`. In later versions, the default has changed such that `*` does not match the path separator. In contrast, double wildcard (`**`) can match also a path separator.
* Fix anchor links in documentation
* Move strict to mkdocs config
* add mkdocs to CI
---------
Co-authored-by: Jose Quintana <1700322+joseluisq@users.noreply.github.com>
* Enable literal_separator for redirects
This ensures that * does not match the path separator.
* Fix tests
* Update documentation
BREAKING CHANGE: Up to version 2.33.1 the wildcard `*` was matching the path separator. For example, `/{*}/{*}/` matched `/assets/images/logo/`. In later versions, the default has changed such that `*` does not match the path separator. In contrast, double wildcard (`**`) can match also a path separator.
Adds a `log-forwarded-for` option to control if the X-Forwarded-For
header information should be logged.
Also includes a `trusted-proxies`
option to optionally specify from which IPs to accept this header.
Existing uses of log-remote-address will stop logging forwarded-for
IPs after this change.
via a new `static-web-server generate` subcomand.
* feat: generate man page and completions
* fix: missing Windows imports in binary server entrypoint
* refactor: log completions and man pages generation using server_info
---------
Co-authored-by: Jose Quintana <joseluisquintana20@gmail.com>
Via a new advanced configuration entry.
The feature also supports expiration policies such as Time To Live (TTL) and Time To Idle (TTI).
Admission to a cache is controlled by the Least Frequently Used (LFU) policy and the eviction from a cache is controlled by the Least Recently Used (LRU) policy.
Example:
```toml
[general]
[advanced]
[advanced.memory-cache]
# Maximum capacity entries of the memory cache-store. Default 256
capacity = 256
# Time to live in seconds of a cached file entry. Default 1h
ttl = 3600
# Time to idle in seconds of a cached file entry. Default 5min
tti = 300
# Maximum size in bytes for a file entry to be cached. Default 8MB
max-file-size = 8192
```
Note that this feature requires Rust 1.76.0 or newer.
This feature is **experimental**. However, when stabilized then a cargo feature will be available as well as a proper documentation page.
* feat: disable symlinks option
--disable-symlinks[=<DISABLE_SYMLINKS>]
Prevent following files or directories if any path name component is
a symbolic link [env: SERVER_DISABLE_SYMLINKS=] [default: false]
[possible values: true, false]
* chore: add tests
* docs: feature page [skip ci]