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
File extension/Image src does not end to server route but 404 #7403
We ran into the same issue with a TanStack Start + nitro/vite app: <img src="/api/v1/projects/:id/thumbnail"> returns 404 text/html in dev, but opening the same URL directly works fine. It looks like that the trigger is the Sec-Fetch-Dest: image header as the Sec-Fetch-Dest: empty header when using fetch works
I tried nitro-nightly@3.0.1-20260519-181425-9cc59cf7, which includes #4272 ("fix(vite): route asset-extensioned URLs matching explicit routes to nitro") and the related 7d49dca ("route extensionless URLs matching a nitro route to nitro under asset sec-fetch-dest")
Unfortunately those nightly fixes didn't help for my TanStack Start app
However TanStack API routes live at src/routes/api/** and register via viteDevServer.middlewares.use(...)
Therefore nitro.routing.routes holds only the SSR catch-all /** and isExplicitRoute is always false and every /api/v1/* request falls through to the Sec-Fetch-Dest classifier
Activity
[-]File extension[/-][+]File extension/Image src does not end to server route but 404[/+]schiller-manuel commentedon May 15, 2026
i suspect this is a nitro issue
cc @pi0
@Zareix does this occur if you disable nitro?
Zareix commentedon May 15, 2026
Indeed it works without nitro plugin
pi0 commentedon May 15, 2026
Likely related to nitrojs/nitro#4252 (comment)
I have to investigate it properly since it is 3rd time we are regressing on patches in this area. Sorry for inconviniences.
Zareix commentedon May 15, 2026
Ok thank you I'll track this issue
Btw it seems to be only on dev server
jantimon commentedon May 19, 2026
We ran into the same issue with a TanStack Start +
nitro/viteapp:<img src="/api/v1/projects/:id/thumbnail">returns404 text/htmlin dev, but opening the same URL directly works fine. It looks like that the trigger is theSec-Fetch-Dest: imageheader as theSec-Fetch-Dest: emptyheader when using fetch worksI tried
nitro-nightly@3.0.1-20260519-181425-9cc59cf7, which includes #4272 ("fix(vite): route asset-extensioned URLs matching explicit routes to nitro") and the related7d49dca("route extensionless URLs matching a nitro route to nitro under asset sec-fetch-dest")Unfortunately those nightly fixes didn't help for my TanStack Start app
The fixed
nitroDevMiddlewarePrecheckes for matchingnitro.routing.routesAs far as i can tell the
nitro.routing.routesvalues come fromscanHandlers, which only scans<srcDir>/api/and<srcDir>/routes/However TanStack API routes live at
src/routes/api/**and register viaviteDevServer.middlewares.use(...)Therefore
nitro.routing.routesholds only the SSR catch-all/**andisExplicitRouteis alwaysfalseand every/api/v1/*request falls through to theSec-Fetch-DestclassifierSo https://github.com/Zareix/tan-start-repro is still broken even with
nitro-nightly@3.0.1-20260519-181425-9cc59cf7Not sure who is to blame.. Tanstack and Nitro just follow their conventions..
As a hacky workaround you can just handle all api routes explicitly with vite:
pi0 commentedon May 20, 2026
draft nitrojs/nitro#4274 (hoping we can find something more stable)
jinl0ng commentedon Jun 18, 2026
same here
gustavo-bordin commentedon Jun 24, 2026
same here
perf(covers): optimize cover load & caching
fix(vite): only treat html responses as catch-all swallows
dennisameling commentedon Sep 16, 2026
Confirming this is fixed by nitrojs/nitro#4467, which is now live in
Nitro's nightly buildsv3.0.260903-beta 🚀