| name | wsh-server-tuning |
| description | Server-side optimizations for WSH 2026 — compression (gzip/brotli), cache headers, static asset caching, artificial delay removal, and Express tuning. |
WSH: Server Tuning
Server-side optimizations reduce transfer sizes and improve response times. Compression alone can reduce text-based assets by 60-80%.
Use this skill when optimizing Express server configuration, cache headers, compression, or removing artificial delays.
Techniques
1. Enable Compression
import compression from "compression";
app.use(compression());
Or for better compression, use shrink-ray-current which supports Brotli:
import shrinkRay from "shrink-ray-current";
app.use(shrinkRay());
Impact: FCP -20-40%, LCP -10-20%, SI -20%
2. Fix Cache Headers
res.header({
"Cache-Control": "max-age=0, no-transform",
Connection: "close",
});
app.use("/scripts", express.static(path.join(...), {
maxAge: "1y",
immutable: true,
}));
app.use("/images", express.static(path.join(...), {
maxAge: "1y",
}));
Impact: Repeat-visit performance dramatically improved
3. Enable etag and lastModified
serveStatic(path, { etag: false, lastModified: false })
serveStatic(path, { etag: true, lastModified: true, maxAge: "1y" })
4. Remove Connection: close
The Connection: close header forces new TCP connections for each request, preventing HTTP keep-alive.
5. Remove Crok AI Artificial Delays
await sleep(3000);
await sleep(10);
Impact: User flow score for Crok AI chat improved significantly
Pitfalls
| Pitfall | Symptom | Fix |
|---|
| Compression on already-compressed files (images, videos) | Wasted CPU, no size reduction | Exclude binary types or let the library handle it |
| Cache-Control on API responses | Stale data | Only cache static assets, not API |
| Cache-Control on HTML | Users see stale app | Set no-cache for HTML, long cache for hashed assets |
VRT Risks
| Change | Visual Impact | Mitigation |
|---|
| Compression | None | Safe, Low risk |
| Cache headers | None | Safe, Low risk |
| Delay removal | None visually, timing changes | Safe for VRT |
Project-Specific Notes
- Global cache-disabling middleware in
application/server/src/app.ts
- Static routes in
application/server/src/routes/static.ts with etag/lastModified disabled
- Crok AI delay in
application/server/src/routes/api/crok.ts
Connection: close header forces no keep-alive
- Webpack output filenames don't use content hashes currently (
[name].js not [name].[contenthash].js)
- Consider adding content hash to enable immutable caching