fossology / fossology/LicenseDb
fix(vite): /license route returns 500 in dev server on case-insensitive filesystems (Windows/macOS)
- Dominant language
- Go
- Stars
- 14
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Navigating to the `/license` (licenses list) route in the Vite dev server
returns an HTTP 500 instead of loading the SPA, on any case-insensitive
filesystem (Windows, macOS default APFS/HFS+). This affects both a fresh
navigation to the URL and a browser refresh while already on that route.
## Environment
* OS: Windows 11 (also reproducible on macOS default filesystem)
* Node: (fill in `node -v`)
* Repo commit: b2d0167 (tip of `main` prior to fix) — bug is present on
any commit that has both `vite.config.js` and the repo-root `LICENSE`
file, i.e. it predates this report by a long time
* Dev command: `npm run dev` (Vite dev server)
## Steps to Reproduce
1. `npm install && npm run dev`
2. Open the app in a browser, navigate to `http://localhost:/license`
directly (or refresh the browser while on that route)
3. Observe the dev server responds with a 500 error instead of the SPA
shell
## Expected Behavior
The client-side router (React Router) should handle `/license` and render
the licenses page, exactly as it does for `/`.
## Actual Behavior
The request 500s. The dev server tries to serve/transform the repo-root
`LICENSE` file as if it were the requested module, because on a
case-insensitive filesystem the path `/license` collides with `LICENSE`
before Vite's own SPA history-fallback middleware gets a chance to run.
## Root Cause
Vite's dev server resolves incoming requests against the filesystem before
its built-in SPA fallback middleware executes. On a case-sensitive
filesystem (most Linux setups), `/license` and `LICENSE` are distinct paths
and the fallback runs normally. On Windows/macOS, the filesystem resolves
`/license` to the repo-root `LICENSE` file, so Vite attempts to load that
plain-text file as a JS module and fails with a 500, instead of ever
reaching the SPA fallback that would serve `index.html`.
This is a real correctness bug (not dev-only cosmetic): any contributor or
CI job running the dev server on Windows/macOS cannot load the licenses
page at all.
Contributor guide
Research direction
Start by running `npm install && npm run dev`, then reproduce `/license` on a case-insensitive filesystem. Inspect `vite.config.js` alongside the repo-root `LICENSE` and `index.html` to determine why the request is resolved as a file before the SPA fallback; done means `/license` loads the React licenses page without a 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, vite
- Domain
- frontend, tooling, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100