# Serve a production build

Static and SPA modes, routing, caching, CSP and deployed-site checks.

Requires WU CLI `1.2.0` and WU Framework `4.0.0` for application APIs. Check `wu --version` and the project dependencies.

```sh
wu build
wu serve 4100 --mode static
```

`wu serve [port] [--mode spa|static]` serves `dist/` on `127.0.0.1`. The default port is `3000` and the default mode is `spa`. Invalid or occupied ports and a missing `dist/index.html` produce a nonzero exit status. Stop the server with `Ctrl+C`.

Use `static` for documentation and multipage sites: `/guide/` serves `dist/guide/index.html`, `/guide?lang=en` redirects while preserving its query and unknown routes return `404`. Use `spa` when the shell owns client routing: unknown navigation receives the root index. Missing assets return `404` in both modes, never shell HTML.

HTML, manifests and stable names use revalidation and `no-transform`. Only a filename carrying a verified 12–64 character SHA-256 prefix receives one-year immutable caching. GET and HEAD share headers; HEAD sends no body. The server does not negotiate ETag/304. Catalogs remain fetch-readable even when direct navigation returns 404: that filter does not make manifests secret.

Generated CSP calculates hashes from each response HTML. A literal policy remains host-controlled. TLS, compression and public access belong to the hosting service or reverse proxy. Apply `_headers`, `vercel.json` or `wu-security.conf` as your provider requires and check the result with [remote doctor](/docs/cli/doctor/).