Spring Cloud Gateway的Gateway Filter和Global Filter路由实战
一 代码位置
https://github.com/cakin24/spring-cloud-code/tree/master/ch18-2
二 断点设置
针对AuthSignatureFilter过滤器,断点设置如下:
针对CustomGatewayFilter过滤器,断点设置如下:
三 测试
1 启动ch18-2-provider
2 启动ch18-2-gateway
3 浏览器输入: http://localhost:9000/test?authToken=token
4 进入程序调试
因为AuthSignatureFilter的优先级比CustomGatewayFilter优先级高,所以AuthSignatureFilter先执行,调试结束后,结果如下: