angular - 如何正确测试转发任何未映射的路径?
问题描述
我正在做一个在 jhiptser 上的微服务中实现的项目,我对这两个主题都很陌生。网关应用程序在 Angular 中运行。本应用使用了HashLocationStrategy,但由于需要通过Linkedin集成鉴权,所以将位置策略改为PathLocationStrategy。原因是 Linkedin 应用程序不接受#
所需回调 url 中的哈希值。我现在面临的问题是,在导航到某个路线然后刷新后,我在屏幕上收到一个带有消息的 404:Cannot GET /reset/
我已经阅读了它,并且我知道我需要在服务器端进行修改。具体如下:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class ClientForwardController {
/**
* Forwards any unmapped paths (except those containing a period) to the client {@code index.html}.
* @return forward to client {@code index.html}.
*/
@GetMapping(value = "/**/{path:[^\\.]*}")
public String forward() {
return "forward:/";
}
}
如何在我的开发环境中进行测试?
现在我运行正在运行的应用程序,npm run start
我重现了所描述的内容,当我刷新时,我收到了消息Cannot GET /reset/request
提前致谢
解决方案
推荐阅读
- java - Call Java Enum method from JNI
- algorithm - 如何将节点均匀地分成组间边数最少的组?
- python - Django:Unicode、MySQL 和编码(latin1、koi8-r)
- kotlin - create object expressions with by content equality behavior
- sql - How to update a column using another column value?
- python-2.7 - AttributeError:“上下文”对象没有属性“find_element_by_name”
- .htaccess - LiteSpeed .htaccess 删除文件扩展名
- html - emacs org 导出 HTML:自定义段落与列表边距
- linear-programming - 使用纸浆在混合整数线性规划中公式化函数的平方
- xml - 如何在电子邮件地址中存在的配置文件(xml)中转义下划线“_”?