- `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.
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
```
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.
* 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]
It loads the HTML 404 (`--page404`) and 50x (`--page50x`) error page
content at runtime. This allows changing the content of those HTML
files on demand without restarting the server.
Previously, the error pages were loaded at start-up time (basically
they were static content).
**Some additional improvements:**
- If a relative path is used then it will be resolved under the root directory.
- The default error page values have been changed:
- `--page50x=./50x.html`
- `--page404=./404.html`
In case paths are not found then the server defaults to a generic HTML
message (as before).
* feat: add an optional and quiet /health
* HEAD support for /health
* health endpoint doc
* Update docs/content/features/health-endpoint.md
---------
Co-authored-by: Jose Quintana <1700322+joseluisq@users.noreply.github.com>
* Updated the web server with the latest fixes for blocking and race conditions
* Improve default values based on feedback
* Fix code formatting
---------
Co-authored-by: Johnathan Sharratt <johnathan.sharratt@gmail.com>
Co-authored-by: Jose Quintana <joseluisquintana20@gmail.com>
it adds the ability to ignore hidden files/directories (dotfiles),
preventing them to be served and being included in auto HTML index
pages (directory listing) via the new boolean `--ignore-hidden-files` option.
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.
* Small typo fix of commas
* Also expose if cors header is allowed
* WIP: add cors support to cors option
* Add rough support in code for expose-headers
* Add cors expose option to man page template
* Fix tests to handle expose cors
* Add doc updates for SERVER_CORS_EXPOSE_HEADERS
* added redirect-trailing-slash flag
* add default option to test config
* fixed existing tests
* added tests
* added flag to docs
* refactor: grouping static-files handle parameters into a new type
* implemented change requests
Co-authored-by: Jose Quintana <joseluisquintana20@gmail.com>