diff --git a/docs/config/index.md b/docs/config/index.md index 86a6b7ca41a81f..72d2e2111a0f31 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -403,6 +403,15 @@ export default ({ command, mode }) => { File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#api). +### server.disableDotRule + +- **Type:** `boolean` +- **Default:** `false` + + Allow .(DOT) character in the request path. + + Set to `true` to allow requests to carry .(DOT) character. + ## Build Options ### build.target diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index ce1743d2ad2076..1b8edc2d7f294a 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -120,6 +120,14 @@ export interface ServerOptions { * Should start and end with the `/` character */ base?: string + + /** + * uses https://github.com/bripkens/connect-history-api-fallback#disabledotrule + * Note: Allow .(DOT) character in the request path. + * Set to `true` to allow requests to carry .(DOT) character + * default: false + */ + disableDotRule?: boolean } /** @@ -436,6 +444,7 @@ export async function createServer( if (!middlewareMode) { middlewares.use( history({ + disableDotRule: !!serverConfig.disableDotRule, logger: createDebugger('vite:spa-fallback'), // support /dir/ without explicit index.html rewrites: [