我有一个在Springboot上运行的端口8080上的web服务 . 当我点击下面的url它工作正常:
http://localhost:8080/app,我将网址重定向到以下位置:
http://localhost:8080/myHome/home
现在当我刷新页面时,我得到404
下面是我的index.html的内容:
<base href="/myHome">
的package.json:
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build --dev --deploy-url=\"/app/\"",
"test": "ng test",
"lint": "ng lint",
"e2e": "protractor"
},
我曾尝试使用中提到的LocationStrategy
Angular 2: 404 error occur when I refresh through the browser,但它不适合我 .
2 回答
由于 spring 检查资源/ myHome / home而导致错误,但未找到
资源位置是/ app所以你可以修复 -
要么
我在spring boot 2中遇到了同样的问题 . 我已将资源解析器位置添加为静态目录,如果没有与任何文件匹配,则加载index.html