【发布时间】:2020-02-15 18:09:11
【问题描述】:
我正在使用以下构建设置在 AWS Amplify 控制台上部署我的 nuxtjs 应用程序:
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
对于重定向规则,我有以下内容:
[
{
"source": "/<*>",
"target": "/index.html",
"status": "404",
"condition": null
}
]
一切正常,我可以访问 SPA 应用程序。但是,当我从嵌套 URL(例如:example.com/users/23)进行刷新时,我被重定向到 example.com/index.html 页面,并显示“找不到此页数”错误消息。我知道这可能是因为 vue 路由器的历史模式。 (https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations)
如何修改重写规则来解决这个问题?
【问题讨论】:
标签: amazon-web-services aws-amplify nuxt.js