Skip to content

Commit

Permalink
fix: support serving extension-less files in /public
Browse files Browse the repository at this point in the history
fix #1364
  • Loading branch information
yyx990803 committed Jan 7, 2021
1 parent a79c87e commit a7bca9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/node/server/middlewares/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export function serveStaticMiddleware(
// only serve the file if it's not an html request
// so that html requests can fallthrough to our html middleware for
// special processing
const ext = path.extname(cleanUrl(url))
if (!ext || ext === '.html') {
if (
req.headers.accept?.includes('text/html') ||
path.extname(cleanUrl(url)) === '.html'
) {
return next()
}

Expand Down

0 comments on commit a7bca9c

Please sign in to comment.