nginx部署后刷新页面404问题之historyApiFallback
historyApiFallback
主要作用是解决SPA页面在路由跳转后,进行页面刷新时,返回404的错误
webpakc默认配置了historyApiFallback为true、功能是通过connect-history-api-fallback库实现的
location / {
root /...
# vue工程的路由是history模式
try_files $uri $uri/ /index.html;
index index.html index.html
}
源码
原创
2021-12-01 17:06:39 ·
2884 阅读 ·
0 评论