From f8fb7c1395dd1656e17fd4612cb291d33a22de32 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Sat, 30 Oct 2021 22:50:29 +0200 Subject: [PATCH] docs: last revision improvements [skip ci] --- README.md | 251 ++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- docs/Dockerfile | 4 ---- docs/content/changelog-v1.md | 491 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- docs/content/changelog-v2.md | 370 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- docs/content/examples/cache-control-headers.md | 2 +- docs/content/examples/docker.md | 2 ++ docs/content/examples/error-pages.md | 4 ++-- docs/content/examples/http1.md | 7 ++++--- docs/content/examples/http2-tls.md | 5 +++-- docs/content/getting-started.md | 6 ++++-- docs/content/index.md | 9 +++++---- docs/content/migration.md | 23 ++++++++++++++++++++++- docs/mkdocs.yml | 6 +++--- 13 files changed, 72 insertions(+), 1108 deletions(-) delete mode 100644 docs/content/changelog-v1.md delete mode 100644 docs/content/changelog-v2.md diff --git a/README.md b/README.md index 1af05c1..466cafe 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@
- + />

Static Web Server

@@ -13,38 +13,37 @@
- - [![CI](https://github.com/joseluisq/static-web-server/workflows/CI/badge.svg)](https://github.com/joseluisq/static-web-server/actions?query=workflow%3ACI) [![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/joseluisq/static-web-server/2)](https://hub.docker.com/r/joseluisq/static-web-server/) [![Docker Image Size (tag)](https://img.shields.io/docker/image-size/joseluisq/static-web-server/2)](https://hub.docker.com/r/joseluisq/static-web-server/tags) [![Docker Image](https://img.shields.io/docker/pulls/joseluisq/static-web-server.svg)](https://hub.docker.com/r/joseluisq/static-web-server/) - + + + + +
- -

- Static Web Server (or SWS abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets. -

-#### Notes +**Static Web Server** (or **`SWS`** abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets. -- For `v1` please refer to [1.x](https://github.com/joseluisq/static-web-server/tree/1.x) branch. -- To migrate from `v1` please take a look at [v2.0.0](https://github.com/joseluisq/static-web-server/releases/tag/v2.0.0) release. +It is focused on **lightness and easy to use** principles but keeping [high performance and safety](https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html) powered by [The Rust Programming Language](https://rust-lang.org). -⚡ View [full documentation and examples](https://sws.joseluisq.net/) +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) as well as the latest HTTP/1 - HTTP/2 implementations. + +It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` (`x86`/`x86_64`, `ARM`/`ARM64`) as well as `Docker`. ## Features -- Built with [Rust](https://rust-lang.org) which is focused on [safety, speed, and concurrency](https://kornel.ski/rust-c-speed). -- Memory safety and very reduced CPU and RAM overhead. -- Blazing fast static files-serving and asynchronous powered by latest [Hyper](https://github.com/hyperium/hyper/), [Tokio](https://github.com/tokio-rs/tokio) and a set of [awesome crates](./Cargo.toml). +- Built with [Rust](https://rust-lang.org) which is focused on [safety, speed and concurrency](https://kornel.ski/rust-c-speed). +- Memory safe and very reduced CPU and RAM overhead. +- Blazing fast static files-serving and asynchronous powered by latest [Hyper](https://github.com/hyperium/hyper/), [Tokio](https://github.com/tokio-rs/tokio) and a set of [awesome crates](https://github.com/joseluisq/static-web-server/blob/master/Cargo.toml). - Single __4MB__ (uncompressed) and fully static binary with no dependencies ([Musl libc](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html)). Suitable for running on [any Linux distro](https://en.wikipedia.org/wiki/Linux_distribution) or [Docker container](https://hub.docker.com/r/joseluisq/static-web-server/tags). - Optional GZip, Deflate or Brotli compression for text-based web files only. - Compression on demand via [Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) header. - [Partial Content Delivery](https://en.wikipedia.org/wiki/Byte_serving) support for byte-serving of large files. - Optional [Cache Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers for assets. -- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) responses. -- Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. -- [Termination signal](https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html) handling. +- [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. - [HTTP/2](https://tools.ietf.org/html/rfc7540) + 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. +- Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. - Customizable number of worker threads. - Optional directory listing. - [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) support. @@ -57,216 +56,18 @@ ## Releases -### Docker images - -[hub.docker.com/r/joseluisq/static-web-server](https://hub.docker.com/r/joseluisq/static-web-server/) - -### Release binaries - -[github.com/joseluisq/static-web-server/releases](https://github.com/joseluisq/static-web-server/releases) - -#### Linux - -- **x86** - - `i686-unknown-linux-gnu` - - `i686-unknown-linux-musl` -- **x86_64** - - `x86_64-unknown-linux-gnu` - - `x86_64-unknown-linux-musl` -- **ARM** - - `arm-unknown-linux-gnueabihf` -- **ARM64** - - `aarch64-unknown-linux-musl` - - `aarch64-unknown-linux-gnu` - -#### macOS - -- **x86_64** - - `x86_64-apple-darwin` -- **ARM64** - - `aarch64-apple-darwin` - -#### Windows - -- **x86** - - `i686-pc-windows-msvc` -- **x86_64** - - `x86_64-pc-windows-msvc` - - `x86_64-pc-windows-gnu` -- **ARM64** - - ~~`aarch64-pc-windows-msvc`~~ (temporarily disabled until [briansmith/ring#1167](https://github.com/briansmith/ring/issues/1167)) - -#### FreeBSD - -- **x86** - - `i686-unknown-freebsd` -- **x86_64** - - `x86_64-unknown-freebsd` - -## Usage - -Server can be configured either via environment variables or their equivalent command-line arguments. - -### Environment Variables - -| Variable | Description | Default | -| --- | --- | --- | -| `SERVER_HOST` | Host address (E.g 127.0.0.1). | Default `[::]`. | -| `SERVER_PORT` | Host port | Default `80`. | -| `SERVER_LISTEN_FD` | Optional file descriptor number (e.g. `0`) to inherit an already-opened TCP listener on (instead of using `SERVER_HOST` and/or `SERVER_PORT` ). | -| `SERVER_ROOT` | Root directory path of static files | Default `./public`. | -| `SERVER_LOG_LEVEL` | Specify a logging level in lower case. (Values `error`, `warn`, `info`, `debug`, `trace`). | Default `error` | -| `SERVER_ERROR_PAGE_404` | HTML file path for 404 errors. | If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/404.html`. | -| `SERVER_ERROR_PAGE_50X` | HTML file path for 50x errors. | If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/50x.html` | -| `SERVER_THREADS_MULTIPLIER` | Number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula: `worker threads = number of CPUs * n` where `n` is the value that changes here. When multiplier value is 0 or 1 then the `number of CPUs` is used. Number of worker threads result should be a number between 1 and 32,768 though it is advised to keep this value on the smaller side. | Default one thread per core. | -| `SERVER_HTTP2_TLS` | Enable HTTP/2 with TLS support. Make sure also to adjust current server port. | Default `false` | -| `SERVER_HTTP2_TLS_CERT` | Specify the file path to read the certificate. | Default empty | -| `SERVER_HTTP2_TLS_KEY` | Specify the file path to read the private key. | Default empty | -| `SERVER_CORS_ALLOW_ORIGINS` | Specify a optional CORS list of allowed origin hosts separated by comas. Host ports or protocols aren't being checked. Use an asterisk (*) to allow any host. | Default empty (which means CORS is disabled) | -| `SERVER_COMPRESSION` | Gzip, Deflate or Brotli compression on demand determined by the *Accept-Encoding* header and applied to text-based web file types only. See [ad-hoc mime-type list](https://github.com/joseluisq/static-web-server/blob/master/src/compression.rs#L20) | Default `true` (enabled) | -| `SERVER_DIRECTORY_LISTING` | Enable directory listing for all requests ending with the slash character (‘/’) | Default `false` (disabled) | -| `SERVER_SECURITY_HEADERS` | Enable security headers by default when HTTP/2 feature is activated. Headers included: `Strict-Transport-Security: max-age=63072000; includeSubDomains; preload` (2 years max-age), `X-Frame-Options: DENY`, `X-XSS-Protection: 1; mode=block` and `Content-Security-Policy: frame-ancestors 'self'` | Default `false` (disabled) | -| `SERVER_CACHE_CONTROL_HEADERS` | Enable cache control headers for incoming requests based on a set of file types. The file type list can be found on [`src/control_headers.rs`](./src/control_headers.rs) file. | Default `true` (enabled) | -| `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) | - -### Command-line arguments - -CLI arguments listed with `static-web-server -h`. - -``` -static-web-server 2.1.0 -Jose Quintana -A blazing fast and asynchronous web server for static files-serving. - -USAGE: - static-web-server [OPTIONS] - -FLAGS: - -h, --help Prints help information - -V, --version Prints version information - -OPTIONS: - --basic-auth - It provides The "Basic" HTTP Authentication scheme using credentials as "user-id:password" pairs. Password - must be encoded using the "BCrypt" password-hashing function [env: SERVER_BASIC_AUTH=] [default: ] - -e, --cache-control-headers - Enable cache control headers for incoming requests based on a set of file types. The file type list can be - found on `src/control_headers.rs` file [env: SERVER_CACHE_CONTROL_HEADERS=] [default: true] - -x, --compression - Gzip, Deflate or Brotli compression on demand determined by the Accept-Encoding header and applied to text- - based web file types only [env: SERVER_COMPRESSION=] [default: true] - -c, --cors-allow-origins - Specify an optional CORS list of allowed origin hosts separated by comas. Host ports or protocols aren't - being checked. Use an asterisk (*) to allow any host [env: SERVER_CORS_ALLOW_ORIGINS=] [default: ] - -z, --directory-listing - Enable directory listing for all requests ending with the slash character (‘/’) [env: - SERVER_DIRECTORY_LISTING=] [default: false] - -f, --fd - Instead of binding to a TCP port, accept incoming connections to an already-bound TCP socket listener on the - specified file descriptor number (usually zero). Requires that the parent process (e.g. inetd, launchd, or - systemd) binds an address and port on behalf of static-web-server, before arranging for the resulting file - descriptor to be inherited by static-web-server. Cannot be used in conjunction with the port and host - arguments. The included systemd unit file utilises this feature to increase security by allowing the static- - web-server to be sandboxed more completely [env: SERVER_LISTEN_FD=] - -a, --host - Host address (E.g 127.0.0.1 or ::1) [env: SERVER_HOST=] [default: ::] - - -t, --http2 - Enable HTTP/2 with TLS support [env: SERVER_HTTP2_TLS=] [default: false] - - --http2-tls-cert - Specify the file path to read the certificate [env: SERVER_HTTP2_TLS_CERT=] [default: ] - - --http2-tls-key - Specify the file path to read the private key [env: SERVER_HTTP2_TLS_KEY=] [default: ] - - -g, --log-level - Specify a logging level in lower case. Values: error, warn, info, debug or trace [env: SERVER_LOG_LEVEL=] - [default: error] - --page404 - HTML file path for 404 errors. If path is not specified or simply don't exists then server will use a - generic HTML error message [env: SERVER_ERROR_PAGE_404=] [default: ./public/404.html] - --page50x - HTML file path for 50x errors. If path is not specified or simply don't exists then server will use a - generic HTML error message [env: SERVER_ERROR_PAGE_50X=] [default: ./public/50x.html] - -p, --port Host port [env: SERVER_PORT=] [default: 80] - -d, --root - Root directory path of static files [env: SERVER_ROOT=] [default: ./public] - - --security-headers - Enable security headers by default when HTTP/2 feature is activated. Headers included: "Strict-Transport- - Security: max-age=63072000; includeSubDomains; preload" (2 years max-age), "X-Frame- - Options: DENY", "X-XSS-Protection: 1; mode=block" and "Content-Security-Policy: frame-ancestors - 'self'" [env: SERVER_SECURITY_HEADERS=] [default: false] - -n, --threads-multiplier - Number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula: - `worker threads = number of CPUs * n` where `n` is the value that changes here. When multiplier value is 0 - or 1 then one thread per core is used. Number of worker threads result should be a number between 1 and - 32,768 though it is advised to keep this value on the smaller side [env: SERVER_THREADS_MULTIPLIER=] - [default: 1] -``` - -## Use of file descriptor socket passing - -Example `systemd` unit files for socket activation are included in the [`systemd/`](systemd/) directory. If -using `inetd`, its "`wait`" option should be used in conjunction with static-web-server's `--fd 0` -option. - -Alternatively, the light-weight [`systemfd`](https://github.com/mitsuhiko/systemfd) utility may be -useful - especially for testing e.g. `systemfd --no-pid -s http::8091 -- path/to/static-web-server --fd 0` - -## Docker - -### Run a container - -```sh -# Scratch image (just the binary) -docker run --rm -it -p 8787:80 joseluisq/static-web-server:2 - -# Or Alpine image -docker run --rm -it -p 8787:80 joseluisq/static-web-server:2-alpine -``` - -### Dockerfile - -```Dockerfile -# Scratch image (just the binary) -FROM joseluisq/static-web-server:2 - -# Or Alpine image -FROM joseluisq/static-web-server:2-alpine -``` - -### Docker stack +- [Docker Hub Images](https://hub.docker.com/r/joseluisq/static-web-server/) +- [Release Binaries](https://github.com/joseluisq/static-web-server/releases) +- [Platforms/Architectures supported](https://sws.joseluisq.net/platforms-architectures/) -[Docker Compose](https://docs.docker.com/compose/) example using [Traefik Proxy](https://traefik.io/): +### Notes -```yaml -version: "3.3" +- If you're looking for `v1` please go to [1.x](https://github.com/joseluisq/static-web-server/tree/1.x) branch. +- If you want to migrate from `v1` to `v2` please take a look at [v2.0.0](https://github.com/joseluisq/static-web-server/releases/tag/v2.0.0) release. -services: - web: - image: joseluisq/static-web-server:2 - environment: - # Note: those envs are customizable but also optional - - SERVER_HOST=127.0.0.1 - - SERVER_PORT=80 - - SERVER_ROOT=/public - volumes: - - ./some-dir-path:/public - labels: - - "traefik.enable=true" - - "traefik.frontend.entryPoints=https" - - "traefik.backend=localhost_dev" - - "traefik.frontend.rule=Host:localhost.dev" - - "traefik.port=80" - networks: - - traefik_net +## Documentation -networks: - traefik_net: - external: true -``` +For API, usage and examples see the [full documentation website](https://sws.joseluisq.net/). ## Contributions diff --git a/docs/Dockerfile b/docs/Dockerfile index 6c4f86a..445fb64 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,5 +1 @@ FROM squidfunk/mkdocs-material - -RUN set -eux \ - && pip install --no-cache-dir \ - "mkdocs-git-revision-date-plugin"; diff --git a/docs/content/changelog-v1.md b/docs/content/changelog-v1.md deleted file mode 100644 index c5d8864..0000000 --- a/docs/content/changelog-v1.md +++ /dev/null @@ -1,491 +0,0 @@ -# Static Web Server v1 - Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -_**Note:** See changelog for v2 under the [master](https://github.com/joseluisq/static-web-server/blob/master/CHANGELOG.md) branch._ - -## v1.18.0 - 2021-08-20 - -__Updates__ - -- [806a276](https://github.com/joseluisq/static-web-server/commit/806a276) Update dependencies including OpenSSL, httparse and related crates. - -__Refactorings__ - -- [c9e7222](https://github.com/joseluisq/static-web-server/commit/c9e7222) Cross-platform `ctrl-c` signal handling including Windows support. -- [3c7d9f6](https://github.com/joseluisq/static-web-server/commit/3c7d9f6) Remove needless borrow on server module. - -__Docs__ - -- [5a14787](https://github.com/joseluisq/static-web-server/commit/5a14787) Changelog support for v1. PR [#50](https://github.com/joseluisq/static-web-server/pull/50) - -## v1.17.1 - 2021-06-30 - -__Fixes__ - -- [f976586](https://github.com/joseluisq/static-web-server/commit/f976586) Fix static file base path not resolved (canonicalized) properly. For example when uri paths map to symlinks on file system. -- [35d5a1e](https://github.com/joseluisq/static-web-server/commit/35d5a1e) Fix missing server version env of "scratch" Dockerfile. - -__Updates__ - -- [1fc9d7f](https://github.com/joseluisq/static-web-server/commit/1fc9d7f) Update dependencies 30.06.2021. - -__Docs__ - -- [8979292](https://github.com/joseluisq/static-web-server/commit/8979292) Describe current supported targets. - -__Refactorings__ - -- [34cd35b](https://github.com/joseluisq/static-web-server/commit/34cd35b) Minor config project updates. - -## v1.17.0 - 2021-06-21 - -__Updates__ - -- [54ae2d9](https://github.com/joseluisq/static-web-server/commit/54ae2d9) Update dependencies which includes OpenSSL crate updates and others (also [299e01c](https://github.com/joseluisq/static-web-server/commit/299e01c)). - -__Features__ - -- [f78de5a](https://github.com/joseluisq/static-web-server/commit/f78de5a) Additionally to current three targets `x86_64-unknown-linux-musl`, `x86_64-apple-darwin`, `x86_64-pc-windows-msvc`. We are supporting six ones more, among which five ARMs stand out: - - `x86_64-unknown-linux-gnu` - - `aarch64-apple-darwin` - - `aarch64-pc-windows-msvc` - - `aarch64-unknown-linux-gnu` - - `aarch64-unknown-linux-musl` - - `arm-unknown-linux-gnueabihf` - -Find those targets attached to this release. - -__Refactorings__ - -- [bf87d7f](https://github.com/joseluisq/static-web-server/commit/bf87d7f) Improve error messages for address binding errors. PR [#43](https://github.com/joseluisq/static-web-server/pull/43) -- [842be1d](https://github.com/joseluisq/static-web-server/commit/842be1d) Update Docker files in order to get the new Linux binary source. - -__Note about releases__ - -[Rust Nightly](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) is powering the releases from now on the CI. This makes possible to reach more targets in the future. -For more details about it see [Rust Nightly targets supported](https://doc.rust-lang.org/nightly/rustc/platform-support.html). -However clarify that the `static-web-server` project is not using any nightly feature but only _**stable Rust**_ ones and also the project is tested against nightly and stable Rust on CI recurrently in order to be notified in case of _"regressions or bugs introduced in Nightly Rust"_. However it is [known](https://stackoverflow.com/a/56067977/2510591) that the nightly compiler is very stable therefore the reason why we have chosen it for release targets via CI like many other popular Rust projects. -In any case, don't hesitate to file an issue. - -## v1.16.0 - 2021-05-26 - -__Updates__ - -- [b0593ff](https://github.com/joseluisq/static-web-server/commit/b0593ff) Binaries compiled with latest Rust [1.52.1](https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html) release. -- [c96cd48](https://github.com/joseluisq/static-web-server/commit/c96cd48) Update dependencies 26.05.2021 - -## v1.15.0 - 2021-04-20 - -__Features__ - -- [8cf7909](https://github.com/joseluisq/static-web-server/commit/8cf7909) Binaries compiled with latest Rust [1.51.0](https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html) release. -- [cfbffb8](https://github.com/joseluisq/static-web-server/commit/cfbffb8) [Alpine 3.13](https://alpinelinux.org/posts/Alpine-3.13.0-released.html) Docker image. - -__Updates__ - -- [12824ed](https://github.com/joseluisq/static-web-server/commit/12824ed) Update dependencies 20.04.2021 (also [996c181](https://github.com/joseluisq/static-web-server/commit/996c181), [c383b8a](https://github.com/joseluisq/static-web-server/commit/c383b8a)). Upgrades also include a OpenSSL security upgrade to `1.1.1k` which fixes `CVE-2021-3450`. More details on https://www.openssl.org/news/secadv/20210325.txt - - -__Docs__ - -- [304288c](https://github.com/joseluisq/static-web-server/commit/304288c) Minor README clarifications. - -## v1.14.0 - 2021-02-14 - -__Features__ - -- [252406d](https://github.com/joseluisq/static-web-server/commit/252406d) Binaries compiled with latest Rust [v1.50.0](https://blog.rust-lang.org/2021/02/11/Rust-1.50.0.html) release. -- [feac82e](https://github.com/joseluisq/static-web-server/commit/feac82e) Directory listing support via new `-i, --directory-listing` boolean flag (equivalent `SERVER_DIRECTORY_LISTING` env variable) which is disabled by default. PR [#32](https://github.com/joseluisq/static-web-server/pull/32) resolves [#31](https://github.com/joseluisq/static-web-server/issues/31). -- [5026bfe](https://github.com/joseluisq/static-web-server/commit/5026bfe) Windows x86_64 binary support (.exe). See binary file attached to this release. PR [#33](https://github.com/joseluisq/static-web-server/pull/33) resolves [#29](https://github.com/joseluisq/static-web-server/issues/29). -- [116cbbf](https://github.com/joseluisq/static-web-server/commit/116cbbf) UTF-8 URL decoding support (also [cfcb6c](https://github.com/joseluisq/static-web-server/commit/cfcb6c) for directory listing) - -__Refactorings__ - -- [4fe89c5](https://github.com/joseluisq/static-web-server/commit/4fe89c5) Trim CORS comma-separated allowed hosts (CORS server argument). -- [8733d2a](https://github.com/joseluisq/static-web-server/commit/8733d2a) Simplify public example asset files. -- [1c1c2af](https://github.com/joseluisq/static-web-server/commit/1c1c2af) Better 4xx/50x status code checks and more concise default error page content. -- [db51d77](https://github.com/joseluisq/static-web-server/commit/db51d77) `Option` type used for certain server arguments. -- [6551018](https://github.com/joseluisq/static-web-server/commit/6551018) Static file middleware searching optimizations which increases web server performance. -- [a6cca08](https://github.com/joseluisq/static-web-server/commit/a6cca08) Improved static file path resolving. -- [5fed730](https://github.com/joseluisq/static-web-server/commit/5fed730) Improved error handling on directory listing feature. -- [d5e6bdd](https://github.com/joseluisq/static-web-server/commit/d5e6bdd) Improve error handling on static files module. -- [b167030](https://github.com/joseluisq/static-web-server/commit/b167030) Optimize few dependencies features which reduces binary size. -- [dd59cd3](https://github.com/joseluisq/static-web-server/commit/dd59cd3) Explicit OS target for signals handling (just Unix-like & Windows distinction) - -__Updates__ - -- [a664866](https://github.com/joseluisq/static-web-server/commit/a664866) Update dependencies 14.02.2021 - -__Codebase__ - -- [533006f](https://github.com/joseluisq/static-web-server/commit/533006f) Refactor project modules structure & incorporate the static file middleware into the project. - -__Docs__ - -- [6887624](https://github.com/joseluisq/static-web-server/commit/6887624) Remove whitespace description for CORS option. - -## v1.13.0 - 2021-01-24 - -__Updates__ - -- [300337e](https://github.com/joseluisq/static-web-server/commit/300337e) Update dependencies 24.01.2021 (also [a72b31d](https://github.com/joseluisq/static-web-server/commit/a72b31d)) - -__Features__ - -- __Github Sponsor support__. Consider to support this project via [Github Sponsor](https://github.com/sponsors/joseluisq ) or Paypal [paypal.me/joseluisqs](https://paypal.me/joseluisqs). -- [63a05fa](https://github.com/joseluisq/static-web-server/commit/63a05fa) HTTP to HTTPS redirection support. PR [#26](https://github.com/joseluisq/static-web-server/pull/26) resolves [#25](https://github.com/joseluisq/static-web-server/issues/25) by [@HenningHolmDE](https://github.com/HenningHolmDE). See [README](https://github.com/joseluisq/static-web-server/tree/1.x#environment-variables) file for more details. -- [77b07be](https://github.com/joseluisq/static-web-server/commit/77b07be) CLI argument aliases for some options. See [README](https://github.com/joseluisq/static-web-server/tree/1.x#command-line-arguments) file for more details. - -__Refactorings__ - -- [61d819d](https://github.com/joseluisq/static-web-server/commit/61d819d) Minor server log info tweaks. -- [d595219](https://github.com/joseluisq/static-web-server/commit/d595219) Prefer `&[]` instead of `Vec` ptr as arg type for `on_server_running` function. - -__Codebase__ - -- [f3008f3](https://github.com/joseluisq/static-web-server/commit/f3008f3) Github Actions as new CI. - -## v1.12.0 - 2021-01-02 - -__Updates__ - -- [c3583f3](https://github.com/joseluisq/static-web-server/commit/c3583f3) Binaries compiled with latest Rust [v1.49.0](https://blog.rust-lang.org/2020/12/31/Rust-1.49.0.html) release. -- [2732bd3](https://github.com/joseluisq/static-web-server/commit/2732bd3) Update dependencies 02.01.2021 (also [acef399](https://github.com/joseluisq/static-web-server/commit/acef399), [a7b3f40](https://github.com/joseluisq/static-web-server/commit/a7b3f40)) - -__Bug fixes__ - -- [c3583f3](https://github.com/joseluisq/static-web-server/commit/c3583f3) Server error response during large file downloads (Macos/Linux). Issue [#24](https://github.com/joseluisq/static-web-server/issues/24) reported by [@lukasa1993](https://github.com/lukasa1993). -The Rust 1.49.0 upgrade solves the issue which was [published on 1.48.0](https://github.com/rust-lang/rust/commit/db7ee7cc0ddf46a52f53a8a141cd0747f829999a) - -__Features__ - -- [62c8fc2](https://github.com/joseluisq/static-web-server/commit/62c8fc2) Alpine 1.12 Docker image. - -__Darwin__ - -- Binary compiled on Mac OS X SDK 10.15 with a minimum 10.14 version. [joseluisq/rust-linux-darwin-builder@v1.49.0](https://github.com/joseluisq/rust-linux-darwin-builder/releases/tag/v1.49.0) - -__Binary sizes__ - -- **Linux:** Static binary size has no changed (__4.8M__) on current version `v1.12.0`. -- **Darwin:** Dynamic binary size was decreased (__0.1M__). From __1.7M__ (`v1.11.0`) to __1.6M__ (current version `v1.12.0`) - -__Codebase__ - -- [7581c99](https://github.com/joseluisq/static-web-server/commit/7581c99) Ignore some project directories. - -## v1.11.0 - 2020-10-15 - -__Updates__ - -- [d4e32ca](https://github.com/joseluisq/static-web-server/commit/d4e32ca) Binaries compiled with latest Rust [v1.47.0](https://blog.rust-lang.org/2020/10/08/Rust-1.47.html) release. -- [dd20c3e](https://github.com/joseluisq/static-web-server/commit/dd20c3e) Update dependencies 15.10.2020 (also [d4e32ca](https://github.com/joseluisq/static-web-server/commit/d4e32ca), [c4db7c6](https://github.com/joseluisq/static-web-server/commit/c4db7c6)) - -__Improvements__ - -- [6d3dc45](https://github.com/joseluisq/static-web-server/commit/6d3dc45) Shrink Darwin binary size. -- [2401b24](https://github.com/joseluisq/static-web-server/commit/2401b24) Include a `SERVER_VERSION` (server release version) env on every Docker image (also [ee47f76](https://github.com/joseluisq/static-web-server/commit/ee47f76), [74040cf](https://github.com/joseluisq/static-web-server/commit/74040cf)). - -__Binary sizes__ - -- **Linux:** Static binary size was increased (__0.5M__). From __4.3M__ (`v1.10.0`) to __4.8M__ (current version `v1.11.0`) -- **Darwin:** Dynamic binary size was decreased (__0.4M__). From __2.1M__ (`v1.10.0`) to __1.7M__ (current version `v1.11.0`) - -__Codebase__ - -- [cbe1783](https://github.com/joseluisq/static-web-server/commit/cbe1783) Automate Docker images versioning with Drone pipelines. - -## v1.10.0 - 2020-07-07 - -__Updates__ - -- [ff2f2ba](https://github.com/joseluisq/static-web-server/commit/ff2f2ba) Binaries compiled with latest Rust [v1.44.1](https://blog.rust-lang.org/2020/06/18/Rust.1.44.1.html) release. -- [9732d47](https://github.com/joseluisq/static-web-server/commit/9732d47) Update dependencies 07.07.2020 (also [eb30e11](https://github.com/joseluisq/static-web-server/commit/eb30e11)) - -__Improvements__ - -- [93aecf2](https://github.com/joseluisq/static-web-server/commit/93aecf2) Use `jemalloc` as global allocator on Linux Musl 64-bit systems. Which increases the web server performance (also [0fda53f](https://github.com/joseluisq/static-web-server/commit/0fda53f)). See more details on PR [#22](https://github.com/joseluisq/static-web-server/pull/22). - -__Linux binary size__ - -Static binary size was increased (__0.2M__). From __4.1M__ (`v1.9.2`) to __4.3M__ (current version `v1.10.0`) - -__Codebase__ - -- [8e5a3c7](https://github.com/joseluisq/static-web-server/commit/8e5a3c7) Refactor project dev structure. - -## v1.9.2 - 2020-06-08 - -__Bugfixes__ - -- [034263e](https://github.com/joseluisq/static-web-server/commit/034263e) Fix regression introduced by commit c0d2891 which displays wrong content type `text/plain` instead of `text/html` for 404/50x error pages. - -## v1.9.1 - 2020-06-08 - -__Updates__ - -- [d87dafd](https://github.com/joseluisq/static-web-server/commit/d87dafd) Binaries compiled with latest Rust [v1.43.1](https://blog.rust-lang.org/2020/05/07/Rust.1.43.1.html) release. -- [0d7038f](https://github.com/joseluisq/static-web-server/commit/0d7038f) Update dependencies 08.06.20 (also [044b4a9](https://github.com/joseluisq/static-web-server/commit/044b4a9)) - -__Improvements__ - -- Update `iron-staticfile-middleware` to [v0.4.2](https://github.com/joseluisq/iron-staticfile-middleware/releases/tag/v0.4.2) which increases slightly performance on every check of text-based mime types array. - -__Refactors__ - -- [c0d2891](https://github.com/joseluisq/static-web-server/commit/c0d2891) Prefer `const` for the default content type on Error Page middeware. -- [c3a7d73](https://github.com/joseluisq/static-web-server/commit/c3a7d73) Minor syntax improvements on the Gzip middeware and the Staticfile handler. -- [f7564f6](https://github.com/joseluisq/static-web-server/commit/f7564f6) Remove unnecessary `to_string` conversion on server address. -- [23a6a15](https://github.com/joseluisq/static-web-server/commit/23a6a15) Remove git tag `latest` of release tag target. - -## v1.9.0 - 2020-05-09 - -__Features__ - -- Binaries compiled with latest Rust [v1.43.0](https://blog.rust-lang.org/2020/04/23/Rust-1.43.0.html) and OpenSSL `v1.1.1g`. More details on [rust-linux-darwin-builder](https://github.com/joseluisq/rust-linux-darwin-builder/releases/tag/v1.43.0) release. -- [b2d2f40](https://github.com/joseluisq/static-web-server/commit/b2d2f40) Partial Content Delivery support. Which allows to serve bytes of large files. Resolves [#15](https://github.com/joseluisq/static-web-server/issues/15). -- [1af7d28](https://github.com/joseluisq/static-web-server/commit/1af7d28) CORS support via `--cors-allow-origins` option and its equivalent env. Resolves [#18](https://github.com/joseluisq/static-web-server/issues/18). -- [ed94c4b](https://github.com/joseluisq/static-web-server/commit/ed94c4b) Enable Gzip compression only for known text-based file types. View file content types on issue [#19](https://github.com/joseluisq/static-web-server/issues/19). -- [77bf538](https://github.com/joseluisq/static-web-server/commit/77bf538) Update dependencies 10.05.2020 (also [b2d2f40](https://github.com/joseluisq/static-web-server/commit/b2d2f40), [7a0fed0](https://github.com/joseluisq/static-web-server/commit/7a0fed0)) - -__Linux binary size__ - -Static binary size was increased (__0.1M__). From __4.0M__ (`v1.8.0`) to __4.1M__ (current version `v1.9.0`) - - -__Documentation__ - -- [e37d513](https://github.com/joseluisq/static-web-server/commit/e37d513) Corresponding documentation updates reflecting changes and features. - -__Codebase__ - -- [1b1174d](https://github.com/joseluisq/static-web-server/commit/1b1174d) Prefer const over static on default error page content. -- [4bda5f3](https://github.com/joseluisq/static-web-server/commit/4bda5f3) Simplify Gzip middleware. -- [9a109d7](https://github.com/joseluisq/static-web-server/commit/9a109d7) Staging CI pipeline. - -## v1.8.0 - 2020-04-21 - -__Overview__ - -This minor release `v1.8.0` introduces the following: - -- `assets` directory path configurable and independent (no more relative to the `root`). This contains a **"breaking change"**. (Please see below). -- `assets` directory route is always the directory name. That means if you have `/public/my-assets` then the route will be `/my-assets`. -- New option for configurable logging levels. `error` log level by default. (More details below). -* Reply with an empty response body on HEAD requests. -* Skip Gzip compression on HEAD requests. -* `root` and `assets` directory paths checking before to start the server. -* Improve logging server information. - -Please view the details involved about this minor release. - -__Features__ - -* [2f7d042](https://github.com/joseluisq/static-web-server/commit/2f7d042) - Configurable assets directory. (minor breaking change). -* [0dd2abe](https://github.com/joseluisq/static-web-server/commit/0dd2abe) - Configurable logging levels (resolves [#16](https://github.com/joseluisq/static-web-server/issues/16)) via `--log-level` option or its equivalent env. Now `error` log level is enabled by default. Use `info` level if you want requests details. Check out the documentation for more options. -* [0a9f66b](https://github.com/joseluisq/static-web-server/commit/0a9f66b) - Update [`iron_staticfile_middleware`](https://github.com/joseluisq/iron-staticfile-middleware) to `v0.3.0`. -* [925c58a](https://github.com/joseluisq/static-web-server/commit/925c58a) - Update dependencies (April 21th 2020). - -__Breaking change__ - -This minor release contains one "breaking change" due to the feature _"configurable assets directory"_ ([2f7d042](https://github.com/joseluisq/static-web-server/commit/2f7d042)). - -__1. Configurable assets directory__ - -This feature makes `assets` directory (`--assets` option and its equivalent `SERVER_ASSETS` env) configurable and independent. - -It means that `assets` directory is no more restricted to be relative to `root` directory. So absolute `paths` work now. - -__1.1. Caveat and solution for relative assets directory__ - -If you are using an `assets` directory path relative to `root` (`v1.7.0` or early). For example if you have a root `./my-root` and assets `./my-assets` directories. Just adjust your `assets` directory path to `./my-root/my-assets` or use another absolute path if you want. - -This is necessary because from now, the `assets` directory is treated as an independent path. So an absolute path is recomendable for both directories (root and assets). - -Otherwise, if you are using the default values provided by the server, you don't need to modify anything. Unless you had specified them yourself. If so, please proceed as explained above. - -__Refactorings__ - -* [59777d7](https://github.com/joseluisq/static-web-server/commit/59777d7) - Empty response body on HEAD requests (also 07bf49b). -* [57184a5](https://github.com/joseluisq/static-web-server/commit/57184a5) - Skip Gzip compression on HEAD requests. -* [e40016d](https://github.com/joseluisq/static-web-server/commit/e40016d) - Root and assets directory paths checking. -* [597fa97](https://github.com/joseluisq/static-web-server/commit/597fa97) - Improve logging server information. - -__Documentation__ - -New options and modifications details were updated, please take a look the documentation on README file. - -* [8a5cf79](https://github.com/joseluisq/static-web-server/commit/8a5cf79) - Clarify assets default option value. -* [0767071](https://github.com/joseluisq/static-web-server/commit/0767071) - Docker stack notes about assets directory functionality. - -__Codebase__ - -* [a449eb3](https://github.com/joseluisq/static-web-server/commit/a449eb3) - Refactor path helpers implementation. -* [2e2a6ac](https://github.com/joseluisq/static-web-server/commit/2e2a6ac) - Simplify error page implementation. -* [ff4ec6e](https://github.com/joseluisq/static-web-server/commit/ff4ec6e) - Static file unit test cases. -* [48b92ef](https://github.com/joseluisq/static-web-server/commit/48b92ef) - Skip files of Docker build context. - -## v1.7.0 - 2020-04-04 - -__Features__ - -- [052c18d](https://github.com/joseluisq/static-web-server/commit/052c18d) Binaries compiled with latest Rust [v1.42.0](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html) -- [4ae5b1a](https://github.com/joseluisq/static-web-server/commit/4ae5b1a) Update dependencies (April 4th 2020) - -__Linux binary size__ - -Static binary size was increased (__0.1M__). From __3.9M__ (`v1.6.0`) to __4.0M__ (current version `v1.7.0`) - -__Codebase__ -- [18a6cd5](https://github.com/joseluisq/static-web-server/commit/18a6cd5) - Simplify makefile build tagets. Includes checksum task (also [1c3abdf](https://github.com/joseluisq/static-web-server/commit/1c3abdf)) -- Among other project structural improvements - -## v1.6.0 - 2020-03-04 - -__Features__ - -- [d0e7a7f](https://github.com/joseluisq/static-web-server/commit/d0e7a7f) Binaries compiled with latest Rust [v1.41.1](https://blog.rust-lang.org/2020/02/27/Rust-1.41.1.html). -- [a2a4e98](https://github.com/joseluisq/static-web-server/commit/a2a4e98) Signals termination support. View feature issue [#13](https://github.com/joseluisq/static-web-server/issues/13) resolved by PR [#14](https://github.com/joseluisq/static-web-server/pull/14). -- [08d5847](https://github.com/joseluisq/static-web-server/commit/08d5847) Docker Alpine image upgraded to latest `v3.11`. -- [20b9fd2](https://github.com/joseluisq/static-web-server/commit/20b9fd2) Docker entrypoint shell script for Alpine image. It gives the ability to pass flag arguments on a `docker run` execution or via the `command` option in a `docker-compose` file. Example: `docker run --rm static-web-server:alpine --help`. Flag arguments (with dashes) will be passed to `static-web-server`, otherwise they will be treated as shell commands. Example of an interactive run: `docker run --rm -it static-web-server:alpine sh`. -- [881f37c](https://github.com/joseluisq/static-web-server/commit/881f37c) Dependency updates 03.03.2020. (also [a96e031](https://github.com/joseluisq/static-web-server/commit/a96e031), [c0e96e8](https://github.com/joseluisq/static-web-server/commit/c0e96e8)) - -__Linux binary size__ - -Static binary size was reduced (__0.3M__). From __4.2M__ (`v1.5.0`) to __3.9M__ (current version `v1.6.0`) - - -__Codebase__ - -- [bac3914](https://github.com/joseluisq/static-web-server/commit/bac3914) `openssl` as dev-dependency vendored. -- [27dd9ff](https://github.com/joseluisq/static-web-server/commit/27dd9ff) Update makefile cross-compiling tasks using `rust-linux-darwin-builder` (also [38808fb](https://github.com/joseluisq/static-web-server/commit/38808fb)). -- [478d100](https://github.com/joseluisq/static-web-server/commit/478d100) Rename Docker file templates. (also [ba105e4](https://github.com/joseluisq/static-web-server/commit/ba105e4)) -- [2adc5db](https://github.com/joseluisq/static-web-server/commit/2adc5db) Relocate Docker templates version script. -- [34e0c59](https://github.com/joseluisq/static-web-server/commit/34e0c59) Minor documentation updates. - - -## v1.5.0 - 2020-02-02 - -__Features__ - -- [6dc5056](https://github.com/joseluisq/static-web-server/commit/6dc5056) Feat: gzip compression on demand via `accept-encoding` header (PR [#12](https://github.com/joseluisq/static-web-server/pull/12) resolves [#10](https://github.com/joseluisq/static-web-server/issues/10)). -- [eaebf82](https://github.com/joseluisq/static-web-server/commit/eaebf82) Feat: Update dependencies Feb 02, 2020. It also resolves [#11](https://github.com/joseluisq/static-web-server/issues/11) `head` request method feature. -- -## v1.4.0 - 2020-01-15 - -__Features__ - -- [d195e74](https://github.com/joseluisq/static-web-server/commit/d195e74) Feat: Add TLS/SSL support (PR [#9](https://github.com/joseluisq/static-web-server/pull/9) resolves [#2](https://github.com/joseluisq/static-web-server/issues/2)). Introducing three new options such as `--tls`, `--tls-pkcs12` and `--tls-pkcs12-passwd` as well as their corresponding environment variables. -- [63f2c82](https://github.com/joseluisq/static-web-server/commit/63f2c82) Docs: Add TLS/SSL section. View [usage](https://github.com/joseluisq/static-web-server#usage) on readme file. -- [9c58c9c](https://github.com/joseluisq/static-web-server/commit/9c58c9c) Feat: Update to latest dependencies Jun 15, 2020. -- Due TLS/SSL feature the __Linux__ binary size has incremented (`2,3MB`) from `1.8MB` to `4.1MB`. - -__Misc__ - -- [cf0fb53](https://github.com/joseluisq/static-web-server/commit/cf0fb53) Docs: Update new options usage in readme file -- [a7d55ad](https://github.com/joseluisq/static-web-server/commit/a7d55ad) Fix: Permissions for Rust project directory -- [86f8d8a](https://github.com/joseluisq/static-web-server/commit/86f8d8a) Feat: Add more sections to Cargo manifest file - -## v1.3.0 - 2020-01-07 - -__Features__ - -- [9179bc3](https://github.com/joseluisq/static-web-server/commit/9179bc3) Add binary support for __Macos__ `x86_64-apple-darwin` thanks to [Rust Linux / Darwin Builder](https://github.com/joseluisq/rust-linux-darwin-builder). Resolves issue [#8](https://github.com/joseluisq/static-web-server/issues/8). -- [1509f5f](https://github.com/joseluisq/static-web-server/commit/1509f5f) Update dependencies Jan 7, 2020 - -__Misc__ - -- [92b04e1](https://github.com/joseluisq/static-web-server/commit/92b04e1) Add Linux and Darwin makefile tasks -- [a7a6d61](https://github.com/joseluisq/static-web-server/commit/a7a6d61) Fix tarball and shrinking makefile tasks -- [56c425a](https://github.com/joseluisq/static-web-server/commit/56c425a) Remove Github release step from Drone pipeline - -## v1.2.0 - 2019-12-26 - -__Features__ - -- [2979f7a](https://github.com/joseluisq/static-web-server/commit/2979f7a) Makes optional the _**error pages feature**_ introducing default response HTML messages for 400 and 50x errors. (PR [#7](https://github.com/joseluisq/static-web-server/pull/7) resolves [#6](https://github.com/joseluisq/static-web-server/issues/6)) - -__Refactors__ - -- [8a90486](https://github.com/joseluisq/static-web-server/commit/8a90486) Update pages and assets example -- [3e64cbb](https://github.com/joseluisq/static-web-server/commit/3e64cbb) Update server config information - -__Misc__ - -- [593ca98](https://github.com/joseluisq/static-web-server/commit/593ca98) Minor documentation updates -- [9f63108](https://github.com/joseluisq/static-web-server/commit/9f63108) Disable Travis CI email notifications - -## v1.1.0 - 2019-12-25 - -__Features__ - -- Rust [v1.40.0](https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html) ([73528e3](https://github.com/joseluisq/static-web-server/commit/73528e3) 2019-12-16) -- CLI options support. PR [#4](https://github.com/joseluisq/static-web-server/pull/4) by [@dlalic](https://github.com/dlalic) resolves [#1](https://github.com/joseluisq/static-web-server/issues/1). See README file for more details. -- Error pages support. PR [#5](https://github.com/joseluisq/static-web-server/pull/5) resolves [#3](https://github.com/joseluisq/static-web-server/issues/3). See README file for more details. -- Binary size increment (`0.4MB`) from `1.4MB` to `1.8MB`. - -__Breaking changes__ - -Due __error HTML pages feature #5__ now the server requires two settings for display 404 and 50x errors. - -For example if you use environment variables try to append following variables with the two paths of your HTML pages: - -```sh -# HTML file path for 404 errors -SERVER_ERROR_PAGE_404=./public/404.html -# HTML file path for 50x errors -SERVER_ERROR_PAGE_50X=./public/50x.html -``` - -Or via CLI options: - -``` ---page404 HTML file path for 404 errors [env: SERVER_ERROR_PAGE_404=] [default: ./public/404.html] ---page50x HTML file path for 50x errors [env: SERVER_ERROR_PAGE_50X=] [default: ./public/50x.html] -``` - -__Refactors__ -- [112a1f3](https://github.com/joseluisq/static-web-server/commit/112a1f3) Update dockefile templates metadata -- [b34624c](https://github.com/joseluisq/static-web-server/commit/b34624c) Dependency updates -- [5e9abd4](https://github.com/joseluisq/static-web-server/commit/5e9abd4) Apply cargo fix --edition to entire project -- [4712b9c](https://github.com/joseluisq/static-web-server/commit/4712b9c) Minor tweaks for Cargo make tasks -- [6fb65b2](https://github.com/joseluisq/static-web-server/commit/6fb65b2) Rename `env.rs` to `config.rs`. -- New updated fork dependency [iron-staticfile-middleware](https://github.com/joseluisq/iron-staticfile-middleware) -- Minor project code base improvements - -## v1.0.0 - 2019-11-28 - -This is the first major release :zap: - -__Features__ - -- Rust [v1.39.0](https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html) ([4560ea788](https://github.com/joseluisq/static-web-server/commit/4560ea788) 2019-11-04) -- Binary size reduction for this current release from `1.6MB` to `1.4MB`. - -## v1.0.0-beta.4 - 2019-11-28 - -__Updates__ - -- [eb96054](https://github.com/joseluisq/static-web-server/commit/eb96054) Refactor project structure -- [eb96054](https://github.com/joseluisq/static-web-server/commit/eb96054) Update dependencies -- [eb96054](https://github.com/joseluisq/static-web-server/commit/eb96054) Support for latest Rust [v1.39.0](https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html) (`[4560ea7](https://github.com/joseluisq/static-web-server/commit/4560ea7)` 2019-11-04) - -__Deployment__ - -- [2fd780e](https://github.com/joseluisq/static-web-server/commit/2fd780e) Fix Cargo package config file name and version extraction -- [3a69088](https://github.com/joseluisq/static-web-server/commit/3a69088) Fix release tarball files generation - -__Misc__ - -- Binary size reduction for this current release from `1.6M` to `1.4M`. - -## v1.0.0-beta.3 - 2019-10-10 -__Features__ - -- Add [Rust v1.38.0](https://blog.rust-lang.org/2019/09/26/Rust-1.38.0.html) ([625451e](https://github.com/joseluisq/static-web-server/commit/625451e) 2019-09-23) compiling support. - -## v1.0.0-beta.2 - 2019-09-05 diff --git a/docs/content/changelog-v2.md b/docs/content/changelog-v2.md deleted file mode 100644 index a804804..0000000 --- a/docs/content/changelog-v2.md +++ /dev/null @@ -1,370 +0,0 @@ -# Static Web Server v2 - Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -_**Note:** See changelog for v1 under the [1.x](https://github.com/joseluisq/static-web-server/blob/1.x/CHANGELOG.md) branch._ - -## v2.1.0 - 2021-10-23 - -__Fixes__ - -* [5f3842b](https://github.com/joseluisq/static-web-server/commit/5f3842b) Update dependencies including Hyper, Tokio, h2, futures, tracing bug/security fixes and related crates (also [5528bcb](https://github.com/joseluisq/static-web-server/commit/5528bcb), [dc98fbb](https://github.com/joseluisq/static-web-server/commit/dc98fbb)). -* [62e98c6](https://github.com/joseluisq/static-web-server/commit/62e98c6) `aarch64-unknown-linux-musl` build fails using Rust nightly. - -__Features__ - -- [abc76a8](https://github.com/joseluisq/static-web-server/commit/abc76a8) Basic HTTP Authentication support via the new `--basic-auth` option. PR [#55](https://github.com/joseluisq/static-web-server/pull/55) resolves [#53](https://github.com/joseluisq/static-web-server/issues/53) suggested by [@bjornharrtell](https://github.com/bjornharrtell). - -__Refactorings__ - -- [0273611](https://github.com/joseluisq/static-web-server/commit/0273611) Prefer `futures-util` over `futures` dependency. -- [c3bfa68](https://github.com/joseluisq/static-web-server/commit/c3bfa68) Use [Rust 1.56.0 (2021 Edition)](https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html) on CI. - -__Docs__ - -- [f89c5c9](https://github.com/joseluisq/static-web-server/commit/f89c5c9) Describe Basic HTTP Authentication feature. -- [a6d0e53](https://github.com/joseluisq/static-web-server/commit/a6d0e53) Minor general description improvements. - -## v2.0.3 - 2021-09-29 - -__Fixes__ - -* [5de5874](https://github.com/joseluisq/static-web-server/commit/5de5874) Update dependencies including Hyper, Tokio, http, futures, tracing bug fixes and related crates (also [1c6c873](https://github.com/joseluisq/static-web-server/commit/1c6c873) [34efa49](https://github.com/joseluisq/static-web-server/commit/34efa49), [6fb832b](https://github.com/joseluisq/static-web-server/commit/6fb832b)) - -__Refactorings__ - -- [b2f09ab](https://github.com/joseluisq/static-web-server/commit/b2f09ab) Remove optional extra Docker volume `/public` of `scratch` and `alpine` images. PR [#52](https://github.com/joseluisq/static-web-server/pull/52) resolves [#51](https://github.com/joseluisq/static-web-server/issues/51) reported by [@bergi9](https://github.com/bergi9). -- [906106f](https://github.com/joseluisq/static-web-server/commit/906106f) Remove never read `origins_str` field on Cors module. -- [6f7a6bc](https://github.com/joseluisq/static-web-server/commit/6f7a6bc) Fix Rust edition idioms. - -__Tests__ - -* [166e869](https://github.com/joseluisq/static-web-server/commit/166e869) More Cors test cases. - -## v2.0.2 - 2021-08-29 - -__Fixes__ - -* [ab83e2a](https://github.com/joseluisq/static-web-server/commit/ab83e2a) Update dependencies including Hyper, h2, httparse bug fixes. Tokio leak fix and related crates (also [adb8ca6](https://github.com/joseluisq/static-web-server/commit/adb8ca6)) - -## v2.0.1 - 2021-08-18 - -__Fixes__ - -* [2459ec4](https://github.com/joseluisq/static-web-server/commit/2459ec4) Return incorrect first bytes range when final bytes are requested. For example a request using `Range: bytes=-10` header returned incorrectly the first 10 bytes rather than the last 10 ones. - -__Updates__ - -* [122e1bd](https://github.com/joseluisq/static-web-server/commit/122e1bd) Update dependencies including Hyper and Tokio bug fixes, Brotli, Serde and related crates (also [0b413f9](https://github.com/joseluisq/static-web-server/commit/0b413f9), [fa130fa](https://github.com/joseluisq/static-web-server/commit/fa130fa), [167e1de](https://github.com/joseluisq/static-web-server/commit/167e1de), [fa32375](https://github.com/joseluisq/static-web-server/commit/fa32375), [2d1c5f3](https://github.com/joseluisq/static-web-server/commit/2d1c5f3)) - -__Refactorings__ - -* [8fc1812](https://github.com/joseluisq/static-web-server/commit/8fc1812) Remove needless borrow on static file and handle modules. -* [27f5687](https://github.com/joseluisq/static-web-server/commit/27f5687) UTF-8 for default Docker `index.html` file. -* [ffb2e54](https://github.com/joseluisq/static-web-server/commit/ffb2e54) Update Rust stable to 1.54.0 on CI. - -__Tests__ - -* [5cdcffc](https://github.com/joseluisq/static-web-server/commit/5cdcffc) More directory listing test cases. -* [c7e8ec9](https://github.com/joseluisq/static-web-server/commit/c7e8ec9) More static files test cases. -* [37f2371](https://github.com/joseluisq/static-web-server/commit/37f2371) More static file methods and compression test cases. -* [dd7f995](https://github.com/joseluisq/static-web-server/commit/dd7f995) More static file test cases for during request handling. - -__Docs__ - -* [f389cbc](https://github.com/joseluisq/static-web-server/commit/f389cbc) Minor badges and link updates. - -## v2.0.0 - 2021-07-18 - -The second major stable release is finally available after around half a year of work. It introduces notable changes including new features, performance improvements and new targets support like ARM64 and OSes like FreeBSD. - -This version was re-written almost from scratch on top of [Hyper](https://github.com/hyperium/hyper) and [Tokio](https://github.com/tokio-rs/tokio) runtime which give us the [Rust asynchronous ability](https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html) by default and latest HTTP/1 - HTTP/2 implementation improvements. -However it still try to keep the same principles of its first version: lightness and easy to use. Therefore a migration should not be a big deal. - -Your feedback is very appreciated. - -### Features - -This list only shows new features not present in previous v1. - -- Static Web Server is now asynchronous by default powered by latest Hyper and Tokio. -- It supports opt-in GZip, Deflate and Brotli compression for text-based web files only. -- HTTP/2 + TLS support (via `--http2` option). -- [Security headers](https://github.com/joseluisq/static-web-server/pull/44) like STS, CSP and others for HTTP/2 by default. -- Customizable number of worker threads (via `--threads-multiplier` option). -- [Redesigned directory listing](https://github.com/joseluisq/static-web-server/pull/41) (via `--directory-listing` option). -- Cache control header is now optional (via `--cache-control-headers`). -- Ability to accept a socket listener as a file descriptor for use in sandboxing and on-demand applications (E.g [systemd](http://0pointer.de/blog/projects/socket-activation.html)). Via `--fd` option. Thanks to [@tim-seoss](https://github.com/tim-seoss). -- Binaries for various i686/x86_64 targets (Linux/Windows/FreeBSD) and ARM/ARM64 (Linux/Macos M1) - -For the full list, options details and usage please check it out the [README](https://github.com/joseluisq/static-web-server/blob/master/README.md) file. - -### Breaking changes - -This major version has few breaking changes. -However a migration should not represent a problem. Please have in mind the following changes: - -- The server supports now only a root directory path (via `--root` or its equivalent env) so an assets path option is no longer required. -- Cache control headers is applied to assets in an arbitrary manner. See [src/control_headers.rs](https://github.com/joseluisq/static-web-server/blob/master/src/control_headers.rs) for more details. -- OpenSSL TLS for HTTP/1 is not longer supported instead for the HTTP/2 + TLS (via `--http2` option) the server uses [h2](https://github.com/hyperium/h2) which is on top of [Rustls](https://github.com/ctz/rustls). It means that instead of using a .p12 or .pfx file you can now use only a certificate file along with its private key. More details on [README](https://github.com/joseluisq/static-web-server/blob/master/README.md) file. - -The rest of known options are equivalent to v1 except the new ones of course. -However it's worth to always recommend to test this server update first with your applications on a development environment or similar. - -Please see the full list of options with their details on the [README](https://github.com/joseluisq/static-web-server/blob/master/README.md) file. - ---- - -Changes after the latest `v2.0.0-beta.7` release: - -__Performance__ - -- [157ade1](https://github.com/joseluisq/static-web-server/commit/157ade1) Decrease few allocations during 404/50x error page responses. -- [941572c](https://github.com/joseluisq/static-web-server/commit/941572c) Reduce few allocations on control headers checking. - -__Features__ - -- [012b626](https://github.com/joseluisq/static-web-server/commit/012b626) Cache control headers optional via `--cache-control-headers`. - -__Refactorings__ - -- [5aa587f](https://github.com/joseluisq/static-web-server/commit/5aa587f) Minor syntax improvements on static file module. -- [45988db](https://github.com/joseluisq/static-web-server/commit/45988db) Minor style updates on server module. - -__Docs__ - -- [5bcc629](https://github.com/joseluisq/static-web-server/commit/5bcc629) FreeBSD targets description. -- [dffdf5c](https://github.com/joseluisq/static-web-server/commit/dffdf5c) Changelog support. - -## v2.0.0-beta.7 - 2021-07-09 - -Seventh and last beta release `v2.0.0-beta.7` with notable changes. - -__Updates__ - -- [9e90b38](https://github.com/joseluisq/static-web-server/commit/9e90b38) Hyper 0.14.10 dependency update which fixes two [security issues](https://github.com/hyperium/hyper/releases/tag/v0.14.10). - -__Features__ - -- [432b591](https://github.com/joseluisq/static-web-server/commit/432b591) FreeBSD i686 and x86_64 targets support. - - i686-unknown-freebsd - - x86_64-unknown-freebsd - -Find the binaries for new targets attached to this release. - -__Performance__ - -- [70a76ed](https://github.com/joseluisq/static-web-server/commit/70a76ed) Optimize root path of static file module which increases performance and reduces memory usage. - -__Codebase__ - -- [2aa130d](https://github.com/joseluisq/static-web-server/commit/2aa130d) Move source `./public` to `./docker` dir. - -## v2.0.0-beta.6 - 2021-07-07 - -Sixth beta release `v2.0.0-beta.6` with notable changes. - -__Updates__ - -- [33040d0](https://github.com/joseluisq/static-web-server/commit/33040d0) Update dependencies including latest Tokio and related crates (also [a4ef322](https://github.com/joseluisq/static-web-server/commit/a4ef322), [26b3fbc](https://github.com/joseluisq/static-web-server/commit/26b3fbc), [e07c333](https://github.com/joseluisq/static-web-server/commit/e07c333)). - -__Fixes__ - -- [a1b7836](https://github.com/joseluisq/static-web-server/commit/a1b7836) Missing `Content-Type` header for directory listing index and error pages. - -__Features__ - -- [e2bf778](https://github.com/joseluisq/static-web-server/commit/e2bf778) Windows 64-bit target support. It also improves Ctrl+C signal handling cross-platform. Note Windows ARM64 is in stand by temporarily, see README file for more details. -- [0fa5015](https://github.com/joseluisq/static-web-server/commit/0fa5015) Windows/Linux i686 targets support and one Windows x86_64 - - i686-pc-windows-msvc - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - - x86_64-pc-windows-gnu -- [59cf8bc](https://github.com/joseluisq/static-web-server/commit/59cf8bc) More text-based mime types for compression. - - text/csv - - text/calendar - - text/markdown - - text/x-yaml - - text/x-toml - - application/rtf - - application/xhtml+xml - -Find the binaries for new targets attached to this release and all targets supported also described in the README file. - -__Refactorings__ - -- [2a699e4](https://github.com/joseluisq/static-web-server/commit/2a699e4) Follow symlinks during directory listing, displaying the index page properly for symlinks that points to directories or files. -- [b4f1bcc](https://github.com/joseluisq/static-web-server/commit/b4f1bcc) Prefer stabilized `Poll::map_err` on compression stream. -- [55ffd06](https://github.com/joseluisq/static-web-server/commit/55ffd06) Handle potencial panic for 404/50x error page responses. -- [920acb2](https://github.com/joseluisq/static-web-server/commit/920acb2) Prefer `to_owned()` for string literals over `to_string()` in some cases. -- [c0dca6e](https://github.com/joseluisq/static-web-server/commit/c0dca6e) Improve directory path scanning when directory listing. -- [0ed6287](https://github.com/joseluisq/static-web-server/commit/0ed6287) Auto compression error result logging. -- [87b8744](https://github.com/joseluisq/static-web-server/commit/87b8744) Minor server config info updates. -- [b025536](https://github.com/joseluisq/static-web-server/commit/b025536) Minor code styling and docs changes. - -__Release notes__ - -FreeBSD i686/x86_64 binaries are coming in next and last beta release which is very close to the final v2 releasing. - -## v2.0.0-beta.5 - 2021-06-22 - -Fifth beta release `v2.0.0-beta.5` with notable changes. - -__Updates__ - -- [5343a22](https://github.com/joseluisq/static-web-server/commit/5343a22) Update dependencies including latest Hyper, Tokio and related crates. (also [bcb8493](https://github.com/joseluisq/static-web-server/commit/bcb8493), [e51f969](https://github.com/joseluisq/static-web-server/commit/e51f969), [e51f969](https://github.com/joseluisq/static-web-server/commit/e51f969)) - -__Features__ - -- [c96af53](https://github.com/joseluisq/static-web-server/commit/c96af53) Security headers for HTTP/2 by default (`--security-headers`). PR [#44](https://github.com/joseluisq/static-web-server/pull/44) resolves [#39](https://github.com/joseluisq/static-web-server/issues/39) -- [3c95d1a](https://github.com/joseluisq/static-web-server/commit/3c95d1a) Support five more targets. (also [e6faff8](https://github.com/joseluisq/static-web-server/commit/e6faff8)) - - `x86_64-unknown-linux-gnu` - - `aarch64-apple-darwin` - - `aarch64-unknown-linux-gnu` - - `aarch64-unknown-linux-musl` - - `arm-unknown-linux-gnueabihf` - -Find binaries for those targets attached to this release. - -__Note about releases__ - -[Rust Nightly](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) is powering the releases from now on the CI. This makes possible to reach more targets in the future. -For more details about it see [Rust Nightly targets supported](https://doc.rust-lang.org/nightly/rustc/platform-support.html). -However clarify that the `static-web-server` project is not using any nightly feature but only _**stable Rust**_ ones and the project is also tested against nightly and stable Rust on CI periodically in order to be notified in case of _"regressions or bugs introduced in Nightly Rust"_. However it is [known](https://stackoverflow.com/a/56067977/2510591) that the nightly compiler is very stable therefore the reason why we have chosen it for release targets via CI like many other popular Rust projects. -In any case, please don't hesitate to file an issue or send a PR. - -__Refactorings__ - -- [2b2da3a](https://github.com/joseluisq/static-web-server/commit/2b2da3a) `--http2-tls-cert` and `--http2-tls-key` options now require `--http2` enabled. -- [6fe04a5](https://github.com/joseluisq/static-web-server/commit/6fe04a5) Update Docker files in order to get the new Linux binary source. -- [77d231c](https://github.com/joseluisq/static-web-server/commit/77d231c) Drop redudant reference on CORS module. -- [d5189ec](https://github.com/joseluisq/static-web-server/commit/d5189ec) Drop root arc-path on static files module. - -## v2.0.0-beta.4 - 2021-06-02 - -Fourth beta release `v2.0.0-beta.4` with notable changes. - -__Updates__ - -- [a8b9379](https://github.com/joseluisq/static-web-server/commit/a8b9379) Binaries compiled with latest Rust [1.52.1](https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html) release. -- [c3389cc](https://github.com/joseluisq/static-web-server/commit/c3389cc) Update dependencies including latest Hyper, Tokio and related crates. (also [7cbe483](https://github.com/joseluisq/static-web-server/commit/7cbe483)) - -__Features__ - -- [21bdf8c](https://github.com/joseluisq/static-web-server/commit/21bdf8c) Support inheriting TCP listener from parent process via file descriptor (`-f`, `--fd`). PR [#40](https://github.com/joseluisq/static-web-server/pull/40) by [@tim-seoss](https://github.com/tim-seoss). -- [5428eb3](https://github.com/joseluisq/static-web-server/commit/5428eb3) Redefined directory listing (`-z`, `--directory-listing`). PR [#41](https://github.com/joseluisq/static-web-server/pull/41) -- [d389803](https://github.com/joseluisq/static-web-server/commit/d389803) Opt-in response body auto compression (Gzip, Deflate, Brotli) based on `Accept-Encoding` header (`-x`, `--compression`). -- [74b9eaf](https://github.com/joseluisq/static-web-server/commit/74b9eaf) Just one file associated metadata per request as possible. -- [af9a329](https://github.com/joseluisq/static-web-server/commit/af9a329) CORS support (`-c`, ` --cors-allow-origins`). -- [6ed3fe5](https://github.com/joseluisq/static-web-server/commit/6ed3fe5) Unix-like termination signals handling. - -__Refactorings__ - -- [a8d462a](https://github.com/joseluisq/static-web-server/commit/a8d462a) Drop `Warp` in favor of just `Hyper` + `Tokio`. PR [#38](https://github.com/joseluisq/static-web-server/pull/38) -- [04ec1b1](https://github.com/joseluisq/static-web-server/commit/04ec1b1) One worker thread per available core by default (`-n`, `--threads-multiplier`). -- [991d4b8](https://github.com/joseluisq/static-web-server/commit/991d4b8) Introduce a custom Hyper service implementation for the HTTP1 & HTTP2 web servers. -- [58ff9b7](https://github.com/joseluisq/static-web-server/commit/58ff9b7) Reject non `HEAD` or `GET` requests on static assets and error page handlers. -- [5cede7e](https://github.com/joseluisq/static-web-server/commit/5cede7e) Log info for compression and directory listing features. - -__Docs__ - -All feature flags as well as their equivalent environment variables are described on the updated [README](https://github.com/joseluisq/static-web-server#usage) file. - -## v2.0.0-beta.3 - 2021-04-20 - -Third beta release `v2.0.0-beta.3` with notable changes. - -__Updates__ - -- [7f29c90](https://github.com/joseluisq/static-web-server/commit/7f29c90) Binaries compiled with latest Rust [1.51.0](https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html) release. -- [97d75e0](https://github.com/joseluisq/static-web-server/commit/97d75e0) [Alpine 3.13](https://alpinelinux.org/posts/Alpine-3.13.0-released.html) Docker image. -- [97d75e0](https://github.com/joseluisq/static-web-server/commit/97d75e0) Update dependencies including latest **Tokio** `v1`, **Warp** `v0.3` (with **Hyper** `v0.14`) and related crates (also [e9384e9](https://github.com/joseluisq/static-web-server/commit/e9384e9), [5d4421d](https://github.com/joseluisq/static-web-server/commit/5d4421d)) - -__Refactorings__ - -- [5d8b266](https://github.com/joseluisq/static-web-server/commit/5d8b266) Static server configuration and static default error pages content. -- [e853410](https://github.com/joseluisq/static-web-server/commit/e853410) Drop support for Deflate compression. -- [bbb5a8f](https://github.com/joseluisq/static-web-server/commit/bbb5a8f) Improve log information on server runtime setup. -- [c05471f](https://github.com/joseluisq/static-web-server/commit/c05471f) Tokio server tasks simplifications. -- [7ea40a7](https://github.com/joseluisq/static-web-server/commit/7ea40a7) Minor CLI typos. - -__Fixes__ - -- [99b8b7e](https://github.com/joseluisq/static-web-server/commit/99b8b7e) Linking error for `ring` crate during Darwin build. - -__Docs__ - -- [3c36c9b](https://github.com/joseluisq/static-web-server/commit/3c36c9b) Minor README description improvements. - -## v2.0.0-beta.2 - 2021-01-30 - -Second beta release `v2.0.0-beta.2` with notable changes. - -__Updates__ - -- [9867d71](https://github.com/joseluisq/static-web-server/commit/9867d71) Update dependencies including latest **Tokio** `v1`, **Warp** `v0.3` (with **Hyper** `v0.14`) and related crates. (also [a4421c6](https://github.com/joseluisq/static-web-server/commit/a4421c6), [960a681](https://github.com/joseluisq/static-web-server/commit/960a681), [960a681](https://github.com/joseluisq/static-web-server/commit/960a681)) - -__Features__ - -- [3007e74](https://github.com/joseluisq/static-web-server/commit/3007e74) **Project sponsor support.** Consider to support the project via [github.com/sponsors/joseluisq](https://github.com/sponsors/joseluisq) or [paypal.me/joseluisqs](https://paypal.me/joseluisqs). -- [360ae99](https://github.com/joseluisq/static-web-server/commit/360ae99) Worker threads multiplier option `--threads-multiplier` which provides the ability to customize number of worker threads. -- [ed0d6ac](https://github.com/joseluisq/static-web-server/commit/ed0d6ac) Custom error pages support. -- [4667b10](https://github.com/joseluisq/static-web-server/commit/4667b10) HTTP/2 + TLS support. -- [8c4ce94](https://github.com/joseluisq/static-web-server/commit/8c4ce94) CORS support. - -More details about features on [README](https://github.com/joseluisq/static-web-server/) file. - -__Refactorings__ - -- [6d3e2d1](https://github.com/joseluisq/static-web-server/commit/6d3e2d1) Remove redundant `'static` lifetime on constants. -- [866c7cd](https://github.com/joseluisq/static-web-server/commit/866c7cd) Remove Tokio `macros` feature. -- [f7f2bf6](https://github.com/joseluisq/static-web-server/commit/f7f2bf6) Some improvement suggestions by `Clippy`. -- [bff49a0](https://github.com/joseluisq/static-web-server/commit/bff49a0) Few improvement on filter and helper modules. - -__Codebase__ - -- [7265f6b](https://github.com/joseluisq/static-web-server/commit/7265f6b) Github Actions as new CI. -- [c63b549](https://github.com/joseluisq/static-web-server/commit/c63b549) Remove Travis CI. -- [65250c0](https://github.com/joseluisq/static-web-server/commit/65250c0) Minor simplications on server module. -- [b94fe72](https://github.com/joseluisq/static-web-server/commit/b94fe72) Update core modules structure. -- [da5bdc3](https://github.com/joseluisq/static-web-server/commit/da5bdc3) Re-export few core lib modules. -- [57c27f4](https://github.com/joseluisq/static-web-server/commit/57c27f4) Deny(warnings) on lib -- [a3744d4](https://github.com/joseluisq/static-web-server/commit/a3744d4) Simplify conditionals on rejection filter. - -__Docs__ - -- [933a3c4](https://github.com/joseluisq/static-web-server/commit/933a3c4) Feature documentations updates (also [0ef21c4](https://github.com/joseluisq/static-web-server/commit/0ef21c4)) -- [78033d0](https://github.com/joseluisq/static-web-server/commit/78033d0) CLI arguments and environment variables descriptions. - -## v2.0.0-beta.1 - 2021-01-12 - -First major beta release `v2.0.0-beta.1` with notable changes. - -#### Built-in features - -It uses **Tokio** `v0.2` and **Warp** `v0.2` (**Hyper** `v0.13`). -PR [#28](https://github.com/joseluisq/static-web-server/pull/28) - -- Environment variables and CLI arguments setup -- Lightweight and configurable logging -- Head responses support -- GZip, Deflate and Brotli compression support -- Compression for text-based web file only -- Termination signal handling. -- Default error pages (404, 500x, etc) -- GZip, Deflate or Brotli compression can be optional -- Compression on demand via `Accept-Encoding` header -- Cache control headers for assets -- Docker scratch & Alpine images -- MacOs binary support - -#### Bugfixes - -- Resolves [#24](https://github.com/joseluisq/static-web-server/issues/24) - Error on 8GB file - -#### Additional features - -- Resolves [#17](https://github.com/joseluisq/static-web-server/issues/17) - Make assets directory path optional. Since this major release doesn't include an assets dir just a root. diff --git a/docs/content/examples/cache-control-headers.md b/docs/content/examples/cache-control-headers.md index 2335722..28f5be5 100644 --- a/docs/content/examples/cache-control-headers.md +++ b/docs/content/examples/cache-control-headers.md @@ -1,6 +1,6 @@ # Cache Control Headers -**`SWS`** provides support for [`Cache-Control`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) HTTP header specifying a `public` and `max-age` response directives. +**`SWS`** provides support for *arbitrary* [`Cache-Control`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) HTTP header specifying a `public` and `max-age` response directives. This feature is enabled by default and can be controlled by the boolean `-e, --cache-control-headers` option or the equivalent [SERVER_CACHE_CONTROL_HEADERS](./../configuration/environment-variables.md#server_cache_control_headers) env. diff --git a/docs/content/examples/docker.md b/docs/content/examples/docker.md index 697ba1f..1a22b74 100644 --- a/docs/content/examples/docker.md +++ b/docs/content/examples/docker.md @@ -2,6 +2,8 @@ `SWS` has first-class [Docker](https://docs.docker.com/get-started/overview/) support. It provides a [Scratch](https://hub.docker.com/_/scratch) as well as the latest [Alpine Linux](https://hub.docker.com/_/alpine) Docker images. +🐋 View on [Docker Hub](https://hub.docker.com/r/joseluisq/static-web-server/). + ## Run a container ```sh diff --git a/docs/content/examples/error-pages.md b/docs/content/examples/error-pages.md index e6611d4..5c270da 100644 --- a/docs/content/examples/error-pages.md +++ b/docs/content/examples/error-pages.md @@ -5,9 +5,9 @@ This feature is enabled by default and can be controlled either by the string `--page404` ([SERVER_ERROR_PAGE_404](./../configuration/environment-variables.md#server_error_page_404)) or the `--page50x` ([SERVER_ERROR_PAGE_50X](./../configuration/environment-variables.md#server_error_page_50x)) arguments. !!! info "Tip" - Note that either `--page404` and `--page50x` have defaults (optional values) so they can be specified or omitted as required. + Either `--page404` and `--page50x` have defaults (optional values) so they can be specified or omitted as required. -Below an example of how to customize those HTLM pages. +Below an example of how to customize those HTML pages. ```sh static-web-server \ diff --git a/docs/content/examples/http1.md b/docs/content/examples/http1.md index 8f92c59..a9b00d3 100644 --- a/docs/content/examples/http1.md +++ b/docs/content/examples/http1.md @@ -1,9 +1,10 @@ # HTTP/1 -The HTTP/1 is the protocol by default and can be used specifying a host address via the `-a, --host` ([SERVER_HOST](./../configuration/environment-variables.md#server_host)) argument, the host port via `-p, --port` ([SERVER_PORT](./../configuration/environment-variables.md#server_port)) and the directory of the static files via `-d, --root` ([SERVER_ROOT](./../configuration/environment-variables.md#server_root)) argument. +The HTTP/1 is the protocol by default and can be used specifying a host address via the `-a, --host` ([SERVER_HOST](./../configuration/environment-variables.md#server_host)) argument, the port of the host via `-p, --port` ([SERVER_PORT](./../configuration/environment-variables.md#server_port)) and the directory of the static files using the `-d, --root` ([SERVER_ROOT](./../configuration/environment-variables.md#server_root)) argument. -!!! info "Tip" - Note that either `--host`, `--port` and `--root` have defaults (optional values) so they can be specified or omitted as required. +!!! info "Tips" + - Either `--host`, `--port` and `--root` have defaults (optional values) so they can be specified or omitted as required. + - The server provides [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 by default. Below an example of how to run the server using HTTP/1. diff --git a/docs/content/examples/http2-tls.md b/docs/content/examples/http2-tls.md index 0b1a7df..9eca939 100644 --- a/docs/content/examples/http2-tls.md +++ b/docs/content/examples/http2-tls.md @@ -4,10 +4,11 @@ This feature is disabled by default and can be activated via the boolean `-t, --http2` option as well as string arguments `--http2-tls-cert` (TLS certificate file path) and `--http2-tls-key` (private key file path). -!!! tip "Tips" +!!! info "Tips" - Either `--host`, `--port` and `--root` have defaults (optional values) so they can be specified or omitted as required. - Don't forget to adjust the proper `--port` value for the HTTP/2 & TLS feature. - - When this feature is enabled via `--http2=true` then the [security headers](./security-headers.md) are also enabled automatically. + - When this feature is enabled (`--http2=true`) then the [security headers](./security-headers.md) are also enabled automatically. + - The server provides [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 by default. ```sh static-web-server \ diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md index a0449a5..93b27c2 100644 --- a/docs/content/getting-started.md +++ b/docs/content/getting-started.md @@ -5,9 +5,11 @@ First [download](./download-and-install.md) the binary for your platform. Then just type the following command. ```sh -static-web-server --port 8787 --root ./my-public-dir +static-web-server \ + --port 8787 \ + --root ./my-public-dir ``` For details about the available options type `static-web-server -h` or go to the [Command-line arguments](./configuration/command-line-arguments.md) section. -Or if you are looking fo more advanced examples, take a look at [the examples](./examples/http1.md) section. +Or if you are looking fo more advanced examples then take a look at [the examples](./examples/http1.md) section. diff --git a/docs/content/index.md b/docs/content/index.md index f8bf488..8e8f343 100644 --- a/docs/content/index.md +++ b/docs/content/index.md @@ -16,7 +16,8 @@ - + + @@ -44,11 +45,11 @@ It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` - Compression on demand via [Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) header. - [Partial Content Delivery](https://en.wikipedia.org/wiki/Byte_serving) support for byte-serving of large files. - Optional [Cache Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers for assets. -- [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) responses. -- Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. -- [Termination signal](https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html) handling. +- [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. - [HTTP/2](https://tools.ietf.org/html/rfc7540) + 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. +- Lightweight and configurable logging via [tracing](https://github.com/tokio-rs/tracing) crate. - Customizable number of worker threads. - Optional directory listing. - [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) support. diff --git a/docs/content/migration.md b/docs/content/migration.md index 689e8d2..a9113e2 100644 --- a/docs/content/migration.md +++ b/docs/content/migration.md @@ -1 +1,22 @@ -# Migration +# Migration from v1 to v2 + +The `v2` introduces notable changes including new features, performance improvements and new targets support like ARM64 and OSes like FreeBSD. + +This version `v2` was re-written almost from scratch on top of [Hyper](https://github.com/hyperium/hyper) and [Tokio](https://github.com/tokio-rs/tokio) runtime which give us the [Rust asynchronous ability](https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html) by default and latest HTTP/1 - HTTP/2 implementation improvements. +However it still try to keep the same principles of its `v1`: lightness and easy to use. Therefore a migration should not be a big deal. + +## v2 breaking changes + +This major `v2` has few breaking changes. However a migration should not represent a problem. + + +!!! tip "Tip" + It is always worth recommending that you test a major server version upgrade like this first with your application(s) in a development environment or similar. + +Please have in mind the following changes in `v2`: + +- The server now supports only a root directory path (via `--root` or its equivalent env) so an assets path option is no longer required. +- Cache control headers are applied to assets in an arbitrary manner. See [control headers examples](./examples/cache-control-headers.md) for more details. +- OpenSSL TLS for HTTP/1 is not longer supported instead for the HTTP/2 & TLS (via `--http2` option) the server uses [h2](https://github.com/hyperium/h2) which is on top of [Rustls](https://github.com/ctz/rustls). It means that instead of using a `.p12` or `.pfx` file you can now use only a certificate file along with its private key. See [HTTP/2 & TLS examples](./examples/http2-tls.md) for more details. + +The rest of known options are equivalent to `v1` (except the new ones of course). diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 63477bd..eb27eb1 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -131,9 +131,9 @@ nav: - 'Worker Threads Customization': 'examples/worker-threads.md' - 'Error Pages': 'examples/error-pages.md' - 'Platforms & Architectures': 'platforms-architectures.md' - - 'Changelog v2': 'changelog-v2.md' - - 'Migration': 'migration.md' - - 'Changelog v1': 'changelog-v1.md' + - 'Migration from v1 to v2': 'migration.md' + - 'Changelog v2 (latest stable)': 'https://github.com/joseluisq/static-web-server/blob/master/CHANGELOG.md' + - 'Changelog v1 (stable)': 'https://github.com/joseluisq/static-web-server/blob/1.x/CHANGELOG.md' - 'Semantic Versioning': 'semantic-versioning.md' - 'Contributions': 'contributions.md' - 'License': 'license.md' -- libgit2 1.7.2