diff --git a/server/index.js b/server/index.js index e8b0cf4..9c2e75e 100644 --- a/server/index.js +++ b/server/index.js @@ -253,11 +253,11 @@ if (isProd) { app.use(express.static(distPath)); // SPA 回退:所有非 API 请求返回 index.html - app.get('*', (req, res) => { + app.get('/{*path}', (req, res) => { res.sendFile(path.resolve(distPath, 'index.html')); }); - app.post('*', (req, res) => { + app.post('/{*path}', (req, res) => { res.sendFile(path.resolve(distPath, 'index.html')); }); }