A cross-platform, high-performance and asynchronous web server for static files-serving. ⚡
Note
This is the upcoming v3, currently in development. For production use, see v2 (LTS).
Static Web Server (SWS) is a small, fast, production-ready web server for static file-serving that prioritizes simplicity and ease of use while delivering high performance and safety, powered by Rust. Built on Hyper and Tokio to deliver efficient and performant asynchronous I/O and HTTP/1-2 support with a low resource footprint.
SWS is available for a variety of platforms like Linux, macOS, Windows, FreeBSD, NetBSD, Android and Docker.
- Built with Rust, memory-safe, fast, and concurrent with low CPU and RAM overhead.
- Single ~4 MB static binary with zero runtime dependencies (Musl libc). Runs on any Linux distro or Docker container.
- Fast, asynchronous static file-serving built on Hyper and Tokio.
- On-the-fly compression (Gzip, Deflate, Brotli, Zstandard) for text-based files via
Accept-Encoding. - Serving of pre-compressed files (
.br,.gz,.zst) directly from disk. - Markdown content negotiation to serve
.mdfiles to clients that accepttext/markdown. - Byte-range serving for large file delivery.
- Optional Cache-Control headers and ETag with sensible defaults per file type.
- HTTP/2 + TLS with automatic security headers.
- Graceful shutdown with configurable grace period.
- Structured JSON logging (
--log-format) and file-based log output (--log-file). - Configurable thread pool (worker and blocking threads).
- Optional directory listing with HTML and JSON output, plus
.tar.gzdownload. - CORS with preflight support.
- Basic HTTP authentication (BCrypt).
- Custom response headers per file via glob patterns.
- URL rewrites and redirects with placeholder replacement.
- Virtual hosting with per-host root directories.
- Fallback page for 404 errors (SPA support).
- Custom error pages.
- Built-in HTTP to HTTPS redirect.
- Health check endpoint (GET/HEAD).
- Prometheus metrics endpoint with request counts, latency histograms, and connection tracking.
- Maintenance mode with configurable status.
- Configuration via CLI arguments, environment variables, or a TOML file.
- Windows Service support.
- Socket activation (systemd) for sandboxed and on-demand deployments.
- Available as a Rust library with opt-in features.
- First-class Docker images: Scratch, Alpine Linux, and Debian.
- Cross-platform pre-compiled binaries for
Linux,macOS,Windows,FreeBSD,NetBSD,Android(x86_64,ARM64).
Please refer to The Documentation Website for more details about the API, usage and examples.
from https://github.com/static-web-server/static-web-server

No comments:
Post a Comment