You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
static plugin: setting urlPath prevents all files from being served (5.1.15) #1583
Configuring the built-in static plugin with the documented urlPath option results in no files being served at all — every candidate URL returns 404. Removing urlPath (same files, same glob) serves correctly.
Also 404: /test.css, /assets/web/test.css, /web/test.css (no candidate path serves)
Control cases on the same instance:
config.yaml with only static: { files: 'web/**' } → GET /test.css → 200 ✅
No config.yaml at all (default config) → GET /test.css → 200 ✅
So the regression is isolated to the presence of urlPath.
Expected Behavior
Per the Static Files docs (files and urlPath section): with urlPath: 'assets', GET /assets/test.css should return web/test.css.
Actual Behavior
404 for every path; no error or warning in the log (level warn). At debug level the only nearby output is Initial scan complete, still waiting for N pending file reads. Files added to web/ after startup are also never served, so the plugin's file map appears to stay empty (or is keyed differently than the request handler's staticFiles.get(req.pathname) lookup in server/static.ts expects). resolveBaseURLPath('…', 'assets') → /assets/ and deriveURLPath → /assets/test.css look correct in isolation, so the suspect is the entry pipeline when urlPath is set rather than the URL derivation itself.
Environment
Harper 5.1.15 (npm global install)
Node v24.16.0, macOS (darwin 25.5.0, arm64)
Reproduced under both harper dev and a fresh install's harper start
Workaround
Nest the files so the glob-base strip produces the prefix instead: move files to web/assets/… and use static: { files: 'web/**' } with no urlPath — files then serve at /assets/….
Context
Found while dogfooding the docs-site replatform (serving docs.harperdb.io from Harper).
Root cause from exploratory QA (harper 228eacc0f) — confirmed total serve-outage + traced:
Setting urlPath on the static plugin makes every path 404 (remapped prefix, no-slash, old default paths, root — wrong-prefix ruled out; /assets/ neither serves index nor redirects). Control (files:'web/**', no urlPath) serves all files → plugin is fine.
Mechanism: buildRoutedChain (server/middlewareChain.ts) strips the matched urlPath prefix from req.pathname before the static handler (/assets/style.css → /style.css), but server/static.ts's EntryHandler keys its staticFiles/indexEntries maps by the full baseURLPath including urlPath (/assets/style.css). The stripped lookup key never matches the prefixed map key → every request misses.
Repro: local qa-scratch/qa450-static-urlpath.test.ts.
Activity
Fix static plugin serving nothing when urlPath is configured (#1584)
kriszyp commentedon Jul 6, 2026
Root cause from exploratory QA (harper
228eacc0f) — confirmed total serve-outage + traced:Setting
urlPathon the static plugin makes every path 404 (remapped prefix, no-slash, old default paths, root — wrong-prefix ruled out;/assets/neither serves index nor redirects). Control (files:'web/**', no urlPath) serves all files → plugin is fine.Mechanism:
buildRoutedChain(server/middlewareChain.ts) strips the matchedurlPathprefix fromreq.pathnamebefore the static handler (/assets/style.css→/style.css), butserver/static.ts'sEntryHandlerkeys itsstaticFiles/indexEntriesmaps by the fullbaseURLPathincludingurlPath(/assets/style.css). The stripped lookup key never matches the prefixed map key → every request misses.Repro: local
qa-scratch/qa450-static-urlpath.test.ts.Fix static plugin serving nothing when urlPath is configured (#1584)