> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# server.baseUrl

- **类型：** `string | string[]`
- **默认值：** `undefined`

统一设置服务端路由前缀（常用于多个应用共享同一域名的情况，区分流量)。

```ts title="modern.config.ts"
export default defineConfig({
  server: {
    // 所有生成的路由前面都会自动加上前缀 `/base`
    // 生成的服务端路由文件路径：dist/route.json
    baseUrl: '/base'

    // 多 baseUrl
    baseUrl: ['/base-new', '/base-old']
  }
})
```

`dev` 之后可以看到路由访问会加上对应前缀:

```bash
  > Local:    http://localhost:8080/base/
  > Network:  http://192.168.0.1:8080/base/
```
