【发布时间】:2015-11-28 19:53:07
【问题描述】:
我正在使用 Spring Boot + Cloud | Zuul 代理(org.springframework.cloud:spring-cloud-starter-zuul:1.0.0.RELEASE)。我有以下配置。
info:
component: Zuul Server
endpoints:
restart:
enabled: true
shutdown:
enabled: true
health:
sensitive: false
zuul:
ignoredServices: "*"
proxy:
mapping: /api/v1
addProxyHeaders: true
routes:
service:
path: /service/**
serviceId: service
stripPrefix: false
server:
port: 8765
logging:
level:
ROOT: INFO
org.springframework.web: INFO
eureka:
instance:
preferIpAddress: true
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
我希望访问 URL 以 http://localhost:8765/api/v1/service 为服务,如上述配置中所做的那样(参考:https://github.com/joshlong/microservices-lab/blob/master/api-gateway/gateway/src/main/resources/application.yml)。
但这不起作用,URL http://localhost:8765/service 有效。
有没有办法实现这一点,因为我不希望单个服务具有 /api/v1 上下文。
【问题讨论】:
标签: spring-boot spring-cloud netflix-zuul