64 Commits

Author SHA1 Message Date
Matthias Schoettle
dd43d06551 refactor: format check support Markdown files via mdformat (#597)
* chore: format Markdown files with mdformat
* chore: switch to mdformat config file
* chore: add missing trailing slash
* docs: add section about formatting Markdown files
2025-12-07 10:40:21 +01:00
David Legrand
2c25d823f2 feat: content negotiation for markdown files via Accept header (#577)
* feat: add accept markdown

* docs: add accept markdown feature

* fix: cors error detected by clippy in CI

* fix: simplify markdown handling

* chore: add accept markdown integration tests

* chore: move accept markdown test files

* fix: after review
2025-11-06 15:44:20 +01:00
David Legrand
acd838877b feat: prefer a less-generic config file sws.toml as default (#551)
- `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.
2025-07-02 11:09:04 +02:00
Jose Quintana
b67202baea v2.37.0 2025-06-03 22:31:24 +02:00
ekangmonyet
89f5846ffa feat: support for downloading a directory as a compressed tarball (#544)
$ static-web-server -p 1234 -d ./public \
    --directory-listing --directory-listing-download=targz
2025-05-31 12:15:44 +02:00
Jose Quintana
0236980bc5 feat: control log ANSI output via boolean --log-with-ansi option (#543)
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
```
2025-05-17 14:39:37 +02:00
Jose Quintana
8fa9cdad0d refactor: improve fallback page path checking and logging (#522)
* refactor: check fallback page path and add log debug if not
* refactor: improve fallback page docs and command description
2025-02-03 18:23:12 +01:00
dctaf
134db396cf feat: optional log from X-Real-IP header via new --log-x-real-ip option (#521)
* feat(logger): --log-x-real-ip option.
* docs: Updates for --log-x-real-ip.
2025-02-02 12:51:00 +01:00
Jeidnx
13e3f3861f feat: better x-forwarded-for handling (#495)
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.
2024-11-11 15:00:59 +01:00
Jose Quintana
e6a3487586 v2.33.0 2024-09-17 23:24:19 +02:00
Jose Quintana
eeb88dab51 feat: disable symlinks option via --disable-symlinks (#454)
* 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]
2024-06-11 22:46:50 +02:00
Wladimir Palant
9cbf95b7c5 feat: compression level option support (#381)
* Make fastest compression level the default setting

* Use balanced compression levels by default

* Fixed formatting and addressed clippy warning

* Change default zlib compression level to 3

* Updated docs to mention zlib compression

* Fixed setting spelling in docs

* Don't expose CompressionLevel::into_algorithm_level()

* Updated documentation of the compression feature
2024-05-01 06:42:25 +03:00
Jose Quintana
f8e2d3e462 docs: improve new target page information [skip ci] 2023-11-09 01:31:22 +01:00
Jose Quintana
1fa9261823 refactor: load 404/50x error pages content at runtime (#284)
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).
2023-11-08 23:47:43 +01:00
Jose Quintana
9e5049110c feat: maintenance mode support (#272)
maintenance mode support via new options:

--maintenance-mode=false
--maintenance-mode-status=503
--maintenance-mode-file="./my_maintenance.html"
2023-10-12 22:26:52 +02:00
Jose Quintana
efb2c0cd8a Multiple index files support (#267)
* feat: multiple index files support

option: --index-files="a.html, b.htm, etc"
env: SERVER_INDEX_FILES
default value: "index.html"
2023-10-09 03:25:27 +02:00
Jose Quintana
ddbf8811d2 docs: improve page content [skip ci] 2023-10-02 06:47:20 +02:00
Mac Chaffee
7baf569ef4 feat: virtual hosting support (#252) 2023-08-09 07:43:33 +02:00
Jose Quintana
21939d66fa v2.20.0 2023-07-12 01:25:40 +02:00
Gaëtan Lehmann
b42214b95b feat: optional /health endpoint (#238)
* 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>
2023-07-11 14:20:58 +02:00
Jose Quintana
21c90db067 docs: improve documentation pages [skip ci] 2023-06-16 20:43:45 +02:00
Jose Quintana
d5279fffdd fix: remove obsolete X-XSS-Protection header (2nd)
post update of 91519c9
2023-06-05 02:33:55 +02:00
Jose Quintana
82237a70d6 v2.17.0 2023-06-03 00:19:37 +02:00
Jose Quintana
d3fa602a12 docs: http to https redirect feature [skip ci] 2023-06-02 01:38:18 +02:00
Jose Quintana
415a9a2134 docs: v2.16.0 [skip ci] 2023-04-25 01:35:43 +02:00
Jose Quintana
90ec4b64b5 docs: move to static-web-server.net domain [skip ci]
it also handles automatically redirections from old sws.joseluisq.net
2023-03-27 06:53:11 +02:00
Jose Quintana
cf0d618760 refactor: logo and description 2023-03-19 01:57:00 +01:00
Jose Quintana
2b4912133d docs: v2.15.0 [skip ci] 2023-03-13 02:02:26 +01:00
Syrus Akbary
b9fa2bf3fb feat: add support for --max-blocking-threads (#181)
* 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>
2023-03-07 09:40:56 +01:00
Jose Quintana
c5f13c6429 docs: v2.14.2 [skip ci] 2023-02-15 01:51:29 +01:00
Jose Quintana
8017446d9d docs: v2.14.0 [skip ci] 2022-11-23 00:16:43 +01:00
Jose Quintana
800416d91f feat: ignore hidden files/directories via --ignore-hidden-files (#162)
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.
2022-11-19 02:24:06 +01:00
Jose Quintana
a09ff1f3e2 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.
2022-11-17 16:35:47 +01:00
Frank Sachsenheim
70f37f6397 docs: minor environment variables fixes (#158) [skip ci] 2022-11-01 18:49:07 +01:00
Jose Quintana
fb3fb235bb refactor: update links to new static-web-server organization
new organization link https://github.com/static-web-server
2022-10-20 23:52:32 +02:00
Jose Quintana
697aa9508d docs: v2.13.1 [skip ci] 2022-10-17 01:12:47 +02:00
Jose Quintana
289240f571 v2.13.0 2022-10-12 23:02:19 +02:00
Jose Quintana
3d8c74b99d docs: directory listing format [skip ci]
refs #151
2022-10-12 21:55:11 +02:00
Nelson Chen
f369c80b68 CORS expose headers option (#144)
* 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
2022-10-03 08:07:03 +02:00
Jose Quintana
74fbbb03f3 docs: v2.12.0 [skip ci] 2022-09-28 00:43:52 +02:00
Jose Quintana
3ca743a7b5 docs: pre-compressed files serving feature [skip ci] 2022-09-25 00:11:29 +02:00
Kian-Meng Ang
59a75e6aa9 docs: fix typos (#140) [skip ci]
fix typos found via `codespell -L crate`
2022-09-17 04:13:32 +02:00
Jose Quintana
0dde40528d v2.11.0 2022-08-15 22:51:43 +02:00
Jose Quintana
10f403f1b2 docs: redirect trailing slash page [skip ci] 2022-08-15 22:37:07 +02:00
Philipp Hartenfeller
904c3cb20b New flag to make trailing slash redirect optional (#131)
* 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>
2022-08-13 22:53:56 +02:00
Jose Quintana
e674940b67 docs: minor pages improvements [skip ci] 2022-08-03 23:38:35 +02:00
Jose Quintana
e4228af630 docs: feature and config pages improvements [skip ci] 2022-07-19 02:40:57 +02:00
Jose Quintana
b0ca3d1196 docs: minor typo fixes [skip ci] 2022-07-05 00:06:33 +02:00
Jose Quintana
d0464a7c2f v2.9.0 2022-05-28 22:41:28 +02:00
Jose Quintana
2d71de67f4 docs: log remote address section [skip ci] 2022-05-28 22:22:49 +02:00