404 pages will not be displayed with fallback routes in config
See original GitHub issueDescribe the bug Vue.js app are served with 0.3.0 CLI. When put the fallback routes in config, 404 page is not displayed.
Defined fallback routes following in staticwebapp.config.json
.
{
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/js/*.{js,map}", "/img/*.{png,jpg,gif}", "/css/*"]
}
}
To Reproduce
- Build the Vue application with
npm run build
- Run
swa start ./dist
- Enter the URL of a path that does not exist, for example,
http://localhost:4280/abc
. - You will see a screen with nothing rendered.
Expected behavior 404 page will be displayed.
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Version: 89.0.4389.114
Additional context SWA CLI is 0.3.0 installed via npm
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
MVC 6 Routing, SPA fallback + 404 Error Page - Stack Overflow
I desire the fallback so that my Angular2 app's routes will not result in an HTTP Status Code of 404, Not Found. But...
Read more >Static Web Apps SPA Handle 404 Page Not Found ~ Ozkary
We do not only if we use a fallback policy. Our routing configuration only has three separate routes, and thus it is simple...
Read more >Fallback after getServerSideProps() returns notFound #38839
If a route is matched, that route is used and the fallbacks are never called even if { notFound: true } is returned....
Read more >Handling 404 Routes in React with a Not Found component
In this post you'll learn how to handle 404 routes in React Router and provide a fallback component for displaying an imfamous 404...
Read more >Vue 3 Catch All / 404 Route Not Found | Vue-Router Mastery #2
In this video we take a look at how to setup a fallback inside of your vue application for when a route is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@manekinekko I installed CLI from main branch, and the 404 page is displayed, but fallback does not work.
Fixed by https://github.com/Azure/static-web-apps-cli/pull/179. @k-miyake can you confirm it’s working for you as expected?