当用反向代理解决angular 跨域请求时,重新刷新路由出错404;
来源:7-1 Redux 的概念和实战(一)

风_863495732
2018-08-22
我从路由 localhost:4200 开始访问,默认跳转到localhost:4200/login,当我再次刷新这个路由时,报错404 ,但是在不用反向代理 时不存在这个问题 type Status Report Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
写回答
2回答
-
风_863495732
提问者
2018-08-22
ok,搞定
00 -
接灰的电子产品
2018-08-22
刷新 404 正常,因为这个路由在服务器并不存在。angular是单页应用,即 index.html,所以你需要在 nginx 中将 404 指向 index.html。
00
Angular打造企业级协作平台,让你在Angular领域中出类拔萃
全网首个介绍官方 Material 组件库用法与 Redux 在 Angular 中的应用
998 学习 · 536 问题
相似问题