Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add sample conf for azure static web apps deployment #2371

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/docs/guide/essentials/history-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ Create a `vercel.json` file under the root directory of your project with the fo
}
```

### Azure Static Web Apps

Create a `staticwebapp.config.json` file at the root of your deployed project folder with the following:

```json
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
```

In vue-cli, nuxt, and vite projects, this file usually goes under a folder named `static` or `public`.

## Caveat

There is a caveat to this: Your server will no longer report 404 errors as all not-found paths now serve up your `index.html` file. To get around the issue, you should implement a catch-all route within your Vue app to show a 404 page:
Expand Down
14 changes: 14 additions & 0 deletions packages/docs/zh/guide/essentials/history-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ rewrite {
}
```

### Azure Static Web Apps

创建一个`staticwebapp.config.json`文件,包含在部署目录中,内容如下:

```json
{
"navigationFallback": {
"rewrite": "/index.html"
}
}
```

在 vue-cli、nuxt 和 vite 项目中,这个文件通常放在名为 `static` 或 `public` 的目录下。

## 附加说明

这有一个注意事项。你的服务器将不再报告 404 错误,因为现在所有未找到的路径都会显示你的 `index.html` 文件。为了解决这个问题,你应该在你的 Vue 应用程序中实现一个万能的路由来显示 404 页面。
Expand Down