Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs
Existing minimal servers and comparisons
- Commenters list many single-binary or tiny static servers: redbean, h2o, Caddy, BusyBox httpd, thttpd, Lwan, gatling, filed, various small Go and Crystal servers, node-based
serve, and ad‑hoc tools. - Some argue C/assembly implementations can get binaries below ~500KB and Docker images below 200KB, versus ~18MB for nano‑web’s image.
- Others note that “minimal” is more about reduced attack surface and features than binary size; extreme smallness is not always needed.
SPA routing and HTTP status codes
- A major thread debates SPA routing: whether unknown paths should return
index.htmlwith HTTP 200 or preserve proper 404/40x semantics. - One side: for client-side routers (React Router etc.), the server cannot know valid routes; always serving 200 + index is pragmatic and common, especially for static hosting (e.g., S3).
- Other side: returning 200 for non-existent resources breaks web expectations, SEO, link previews, browser history, and security tooling; servers and tools should support correct 404 with SPA-rendered error content.
- Workarounds discussed: prefix-based handling, sharing route definitions with the server, hash-based routing (
/#...), or using SSG/SSR frameworks (Astro, Next, Hugo, Rails, Phoenix).
CloudFront/S3 behavior for SPAs
- Some recall CloudFront historically not mapping
/dir→/dir/index.htmlwithout Lambda@Edge; others say it now works or depends on S3 website endpoints and specific configuration. - A pattern is to set a 404 fallback page (index.html) for SPAs, which causes every deep link to return 404 status but still render the SPA; acceptable for some private/internal apps but problematic for public sites.
Latency, caching, and performance
- Nano‑web’s in‑RAM caching (including pre-gzipped/brotli assets) is promoted as reducing latency and CPU.
- Critics argue OS page cache +
sendfilealready provide near‑optimal performance; differences are microseconds vs network latency. - Some note TLS/HTTP/3 offload and CDNs usually dominate latency; behind a CDN, choice of static server often barely matters.
Unikernels, deployment, and ecosystem
- A notable aspect is integration with Nanos unikernel, alongside Docker.
- Some are enthusiastic about unikernels as a PaaS-like primitive and want more real‑world usage to validate benefits; tooling is viewed as decent but docs needing improvement.
- Others ask about production adoption of Nanos; concrete large-scale production stories are not provided in the thread.