我正在尝试使用spring-cloud-gateway来构建一个具有负载均衡器的网关,但是当我点击网关时,它给出了404,而不是将我路由到eureka中注册的服务
我不想使用自动发现功能,所以我改用手动路由。
我的代码上传到这里:https://github.com/gry77/poc-spring-cloud-gateway
我怎么才能修复它?
发布于 2021-11-02 12:58:09
从github得到了答案,我必须包含ReWritePath才能使其正常工作
spring:
application:
name: api-gateway
cloud:
gateway:
discovery:
locator:
lower-case-service-id: true
enabled: false
routes:
- id: my-service
uri: lb://my-service
predicates:
- Path=/service/**
filters:
- RewritePath=/service(?<segment>/?.*), /${segment}https://stackoverflow.com/questions/69564959
复制相似问题