Skip to content

Commit

Permalink
Vite Index Middleware should only handle GET requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Haider Ali committed Nov 12, 2023
1 parent 28fd536 commit bdcbe68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ async function injectViteIndexMiddleware(
const config = await getViteConfig();

app.use(Config.ignoreBase ? "/" : config.base, async (req, res, next) => {
if (req.method !== "GET") return next();

if (isIgnoredPath(req.path, req)) return next();

if (isStaticFilePath(req.path)) next();
Expand Down

0 comments on commit bdcbe68

Please sign in to comment.