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
server.fs.strict 'extended' returns 403 for SPA routes that match a root directory #24240
With server.fs.strict: 'extended', an extensionless URL like /home, /Users or /tmp returns 403 when a directory of that name exists at the filesystem root, unless the request sends Sec-Fetch-Dest: document. The log says The request id "/home" is outside of Vite serving allow list. With strict: true the same request gets the SPA fallback (200).
Browsers send Sec-Fetch-Dest: document on navigation, so they are unaffected. Scripted smoke checks (curl -H 'Accept: text/html') and other non-browser clients get 403 for SPA routes whose first path segment happens to match a root directory, such as /home on macOS and Linux.
I'd like to take this one. Reproduced on Windows too (/Users → 403 with strict: 'extended', 200 with strict: true).
The extensionless URL is treated as a JS request (isJSRequest), resolves to the absolute path /home, and with 'extended'isServerAccessDeniedForTransform runs checkLoadingAccess on it. That returns 'denied' because isFileReadable is also true for directories, so the transform middleware sends 403 instead of letting the request fall through to the SPA fallback.
My fix makes checkLoadingAccess return 'fallback' instead of 'denied' when the path is a directory, since a directory can't be loaded or served anyway. A directory with an index.js still resolves to the file, which is still denied. I added a test in dev.spec.ts that requests the first segment of the temp dir (e.g. /tmp, /var, /Users) and expects the HTML fallback. Does this approach look OK?
Activity
moonlorddev commentedon Nov 27, 2026
I'd like to take this one. Reproduced on Windows too (
/Users→ 403 withstrict: 'extended', 200 withstrict: true).The extensionless URL is treated as a JS request (
isJSRequest), resolves to the absolute path/home, and with'extended'isServerAccessDeniedForTransformrunscheckLoadingAccesson it. That returns'denied'becauseisFileReadableis also true for directories, so the transform middleware sends 403 instead of letting the request fall through to the SPA fallback.My fix makes
checkLoadingAccessreturn'fallback'instead of'denied'when the path is a directory, since a directory can't be loaded or served anyway. A directory with anindex.jsstill resolves to the file, which is still denied. I added a test indev.spec.tsthat requests the first segment of the temp dir (e.g./tmp,/var,/Users) and expects the HTML fallback. Does this approach look OK?