OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-web-ui commits / 9113aa2

Fix /web/ URL serving index.html instead of 404
Prefix root (/web/ or /web) now serves index.html directly, matching the SPA fallback behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9113aa2e1f5f3634b62c2e58e15cbf72ab964c17
by plankatron <fleeky@gmail.com> · 2026-03-30T17:46:05.000Z

Changed files (1) +10 -0

lib/static.js +10 -0
……@@ -41,6 +41,16 @@ export function serveStatic (webDir, opts = {}) {
4141 const urlPath = req.url.split('?')[0]
4242
4343 // Serve files under prefix
44 if (urlPath === prefix || urlPath === prefix + '/') {
45 // Prefix root → serve index.html
46 try {
47 const data = fs.readFileSync(indexPath)
48 res.writeHead(200, { 'Content-Type': 'text/html', 'Content-Length': data.length })
49 res.end(data)
50 return true
51 } catch { return false }
52 }
53
4454 if (urlPath.startsWith(prefix + '/')) {
4555 const relPath = urlPath.slice(prefix.length)
4656 const filePath = path.join(webDir, relPath)