问题描述:
在cloud环境下,若应用系统配置了context-path,则无法通过网关进入后台接口管理系统
原因分析:
查看请求信息发现少拼接了系统的context-path,导致无法正确请求到数据。直接使用正确的地址可以正常通过网关访问。故此确定为集成knife4j的问题。
解决办法:
-
gateway中增加引入knife4j-gateway-spring-boot-starter
<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-gateway-spring-boot-starter</artifactId><version>${knife4j-spring-boot-starter.version}</version> </</