From 3f63a0b9434d83b7e6b571ed50ba79bf603abe66 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Thu, 10 Aug 2023 01:06:35 +0200 Subject: [PATCH] docs: improve feature pages [skip ci] --- README.md | 21 ++++++++++++--------- docs/content/features/cors.md | 10 +++++----- docs/content/features/docker.md | 4 ++-- docs/content/features/http-methods.md | 2 +- docs/content/index.md | 21 ++++++++++++--------- docs/content/platforms-architectures.md | 2 +- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 613532c..fb06318 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ It is focused on **lightness and easy-to-use** principles while keeping [high pe Written on top of [Hyper](https://github.com/hyperium/hyper) and [Tokio](https://github.com/tokio-rs/tokio) runtime, it provides [concurrent and asynchronous networking abilities](https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html) and the latest HTTP/1 - HTTP/2 implementations. -It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` (`x86`/`x86_64`, `ARM`/`ARM64`) and `Docker`. +Cross-platform and available for `Linux`, `macOS`, `Windows`, `FreeBSD`, `NetBSD`, `Android`, `Docker` and `Wasm` (via [Warmer](https://wasmer.io/wasmer/static-web-server)). ![static-web-server running](https://github.com/static-web-server/static-web-server/assets/1700322/102bef12-1f30-4054-a1bc-30c650d4ffa7) @@ -49,23 +49,26 @@ It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` - [Termination signal](https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html) handling with [graceful shutdown](https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace) ability and grace period. - [HTTP/2](https://tools.ietf.org/html/rfc7540) and TLS support. - [Security headers](https://web.dev/security-headers/) for HTTP/2 by default. -- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) responses. +- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [OPTIONS](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7) responses. - Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. - Customizable number of blocking and worker threads. -- Optional directory listing. -- [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) support. +- Optional directory listing with sorting and JSON output format support. +- [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) with preflight requests support. - Basic HTTP Authentication. - Customizable HTTP response headers for specific file requests via glob patterns. - Fallback pages for 404 errors, useful for Single-page applications. - Run the server as a [Windows Service](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc783643(v=ws.10)). - Configurable using CLI arguments, environment variables or a TOML file. - Default and custom error pages. -- HTTP to HTTPS redirect. -- Support for serving pre-compressed (Gzip/Brotli/Zstd) files. -- Custom URL rewrites and redirects via glob patterns. +- Built-in HTTP to HTTPS redirect. +- GET/HEAD Health check endpoint. +- Support for serving pre-compressed (Gzip/Brotli/Zstd) files directly from disk. +- Custom URL rewrites and redirects via glob patterns with replacements. +- Virtual hosting support. +- Available as a library crate with opt-in features. - First-class [Docker](https://docs.docker.com/get-started/overview/) support. [Scratch](https://hub.docker.com/_/scratch), latest [Alpine Linux](https://hub.docker.com/_/alpine) and [Debian](https://hub.docker.com/_/alpine) Docker images. -- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g [systemd](http://0pointer.de/blog/projects/socket-activation.html)). -- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows, FreeBSD and Android (`x86`,`x86_64`,`ARM`,`ARM64`). +- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g. [systemd](http://0pointer.de/blog/projects/socket-activation.html)). +- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows, NetBSD, Android (`x86/x86_64`, `ARM/ARM64`) and WebAssembly (via [Warmer](https://wasmer.io/wasmer/static-web-server)). ## Documentation diff --git a/docs/content/features/cors.md b/docs/content/features/cors.md index 378194f..5233570 100644 --- a/docs/content/features/cors.md +++ b/docs/content/features/cors.md @@ -5,7 +5,7 @@ A list of allowed origin hosts (URLs) should be specified and separated by commas. Or an asterisk (*) can be used to allow any host. -This feature is disabled by default and can be controlled by the string `-c, --cors-allow-origins` option or the equivalent [SERVER_CORS_ALLOW_ORIGINS](./../configuration/environment-variables.md#server_cors_allow_origins) env. +This feature is disabled by default and can be controlled by the string `-c, --cors-allow-origins` option or the equivalent [SERVER_CORS_ALLOW_ORIGINS](../configuration/environment-variables.md#server_cors_allow_origins) env. Below is an example of how to enable CORS. @@ -23,11 +23,11 @@ static-web-server \ The server also supports a list of [CORS allowed headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers) separated by commas. -This feature depends on `--cors-allow-origins` to be used along with this feature. It can be controlled by the string `-j, --cors-allow-headers` option or the equivalent [SERVER_CORS_ALLOW_HEADERS](./../configuration/environment-variables.md#server_cors_allow_headers) env. +This feature depends on `--cors-allow-origins` to be used along with this feature. It can be controlled by the string `-j, --cors-allow-headers` option or the equivalent [SERVER_CORS_ALLOW_HEADERS](../configuration/environment-variables.md#server_cors_allow_headers) env. !!! info "Tips" - The default allowed headers value is `origin, content-type`. - - The server also supports [preflight requests](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) via the `OPTIONS` method. See [Preflighted requests in CORS](./../http-methods/#preflighted-requests-in-cors). + - The server also supports [preflight requests](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) via the `OPTIONS` method. See [Preflighted requests in CORS](./http-methods.md#preflighted-requests-in-cors). Below is an example of how to CORS. @@ -43,11 +43,11 @@ static-web-server \ The server also supports a list of [CORS exposed headers to scripts](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers) separated by commas. -This feature depends on `--cors-allow-origins` to be used along with this feature. It can be controlled by the string `--cors-expose-headers` option or the equivalent [SERVER_CORS_EXPOSE_HEADERS](./../configuration/environment-variables.md#server_cors_expose_headers) env. +This feature depends on `--cors-allow-origins` to be used along with this feature. It can be controlled by the string `--cors-expose-headers` option or the equivalent [SERVER_CORS_EXPOSE_HEADERS](../configuration/environment-variables.md#server_cors_expose_headers) env. !!! info "Tips" - The default exposed headers value is `origin, content-type`. - - The server also supports [preflight requests](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) via the `OPTIONS` method. See [Preflighted requests in CORS](./../http-methods/#preflighted-requests-in-cors). + - The server also supports [preflight requests](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) via the `OPTIONS` method. See [Preflighted requests in CORS](./http-methods.md#preflighted-requests-in-cors). Below is an example of how to CORS. diff --git a/docs/content/features/docker.md b/docs/content/features/docker.md index 32fd2a7..6b5d246 100644 --- a/docs/content/features/docker.md +++ b/docs/content/features/docker.md @@ -4,7 +4,7 @@ It is provided in three Docker image variants such as [Scratch](https://hub.docker.com/_/scratch), [Alpine](https://hub.docker.com/_/alpine) and [Debian](https://hub.docker.com/_/debian) images. -All images are available on [Docker Hub](https://hub.docker.com/r/joseluisq/static-web-server/) and [GitHub Container Registry](https://github.com/orgs/static-web-server/packages?repo_name=static-web-server) +All images are available on [Docker Hub](https://hub.docker.com/r/joseluisq/static-web-server/) and [GitHub Container Registry](https://github.com/static-web-server/static-web-server/pkgs/container/static-web-server) ## OS/Arch @@ -24,7 +24,7 @@ All Docker images are [Multi-Arch](https://www.docker.com/blog/how-to-rapidly-bu To give the server a quick try then just run the following commands. !!! tip "Tips" - - [The SWS CLI arguments](/configuration/command-line-arguments/) can be provided directly to the container or omitted as shown below. + - [The SWS CLI arguments](../configuration/command-line-arguments.md) can be provided directly to the container or omitted as shown below. - A Docker volume like `-v $HOME/my-public-dir:/public` can be specified to overwrite the default root directory. To run SWS, there are several Docker image variants that you can use. diff --git a/docs/content/features/http-methods.md b/docs/content/features/http-methods.md index 02ab44b..8b7a9c9 100644 --- a/docs/content/features/http-methods.md +++ b/docs/content/features/http-methods.md @@ -24,7 +24,7 @@ curl -I -X OPTIONS http://localhost:8787/assets/main.js The HTTP [OPTIONS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS) method can also be used to send a request asking if it is acceptable to send requests to the server and if it is aware of using specific methods and headers. !!! info "Tip" - If an `Access-Control-Request-Method` or `Access-Control-Request-Headers` value is not allowed then the server replies with a `403 Forbidden` HTTP error. See [CORS](./../cors/) feature for more details. + If an `Access-Control-Request-Method` or `Access-Control-Request-Headers` value is not allowed then the server replies with a `403 Forbidden` HTTP error. See [CORS](./cors.md) feature for more details. Example using an HTTP client. diff --git a/docs/content/index.md b/docs/content/index.md index e8dcdd5..c73167b 100644 --- a/docs/content/index.md +++ b/docs/content/index.md @@ -36,7 +36,7 @@ It is focused on **lightness and easy-to-use** principles while keeping [high pe Written on top of [Hyper](https://github.com/hyperium/hyper) and [Tokio](https://github.com/tokio-rs/tokio) runtime, it provides [concurrent and asynchronous networking abilities](https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html) and the latest HTTP/1 - HTTP/2 implementations. -It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` (`x86`/`x86_64`, `ARM`/`ARM64`) and `Docker`. +Cross-platform and available for `Linux`, `macOS`, `Windows`, `FreeBSD`, `NetBSD`, `Android`, `Docker` and `Wasm` (via [Warmer](https://wasmer.io/wasmer/static-web-server)). ![static-web-server running](https://github.com/static-web-server/static-web-server/assets/1700322/102bef12-1f30-4054-a1bc-30c650d4ffa7) @@ -53,23 +53,26 @@ It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` - [Termination signal](https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html) handling with [graceful shutdown](https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace) ability and grace period. - [HTTP/2](https://tools.ietf.org/html/rfc7540) and TLS support. - [Security headers](https://web.dev/security-headers/) for HTTP/2 by default. -- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) responses. +- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [OPTIONS](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7) responses. - Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. - Customizable number of blocking and worker threads. -- Optional directory listing. -- [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) support. +- Optional directory listing with sorting and JSON output format support. +- [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) with preflight requests support. - Basic HTTP Authentication. - Customizable HTTP response headers for specific file requests via glob patterns. - Fallback pages for 404 errors, useful for Single-page applications. - Run the server as a [Windows Service](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc783643(v=ws.10)). - Configurable using CLI arguments, environment variables or a TOML file. - Default and custom error pages. -- HTTP to HTTPS redirect. -- Support for serving pre-compressed (Gzip/Brotli/Zstd) files. -- Custom URL rewrites and redirects via glob patterns. +- Built-in HTTP to HTTPS redirect. +- GET/HEAD Health check endpoint. +- Support for serving pre-compressed (Gzip/Brotli/Zstd) files directly from disk. +- Custom URL rewrites and redirects via glob patterns with replacements. +- Virtual hosting support. +- Available as a library crate with opt-in features. - First-class [Docker](https://docs.docker.com/get-started/overview/) support. [Scratch](https://hub.docker.com/_/scratch), latest [Alpine Linux](https://hub.docker.com/_/alpine) and [Debian](https://hub.docker.com/_/alpine) Docker images. -- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g [systemd](http://0pointer.de/blog/projects/socket-activation.html)). -- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows, FreeBSD and Android (`x86`,`x86_64`,`ARM`,`ARM64`). +- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g. [systemd](http://0pointer.de/blog/projects/socket-activation.html)). +- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows, NetBSD, Android (`x86/x86_64`, `ARM/ARM64`) and WebAssembly (via [Warmer](https://wasmer.io/wasmer/static-web-server)). ## Benchmarks diff --git a/docs/content/platforms-architectures.md b/docs/content/platforms-architectures.md index f29d26c..a594ba1 100644 --- a/docs/content/platforms-architectures.md +++ b/docs/content/platforms-architectures.md @@ -3,7 +3,7 @@ Currently, only the following platforms/architectures are supported. !!! tip "Docker tip" - For the list of Docker images supported see [Docker OS/Arch](/features/docker/#osarch) page. + For the list of Docker images supported see [Docker OS/Arch](./features/docker.md#osarch) page. ## Linux -- libgit2 1.7.2