转发到服务时如何禁用 Zuul 修改请求 URL?
How to disable Zuul modifying request URL when forwarding to a service?
这是我的 Zuul 配置(.yml 文件)
server:
port: 8080
zuul:
sensitiveHeaders:
ignored-services: "*"
routes:
ui-service:
path: /online-book-store/**
serviceId: ui-service-v1
stripPrefix: true
auth-service:
path: /auth/**
serviceId: auth-service
book-service:
path: /book-service/**
serviceId: book-service
book-service-genres:
path: /api/genres/**
serviceId: book-service
host:
socket-timeout-millis: 10000
connect-timeout-millis: 10000
eureka:
client:
serviceUrl:
defaultZone: http://localhost:2580/eureka/
我遇到的问题是,当我发送请求时:
<zuul_gateway>/api/genres/listAll
该请求被转发到
<book-service>/listall
我希望它是 <book-service>/api/genres/listAll
所以所有 "matched" 路径都被删除了。我怎样才能禁用它 "feature"
.
将 stripPrefix: false 设置为 book-service-genres。默认情况下,匹配的前缀被删除。
这是我的 Zuul 配置(.yml 文件)
server:
port: 8080
zuul:
sensitiveHeaders:
ignored-services: "*"
routes:
ui-service:
path: /online-book-store/**
serviceId: ui-service-v1
stripPrefix: true
auth-service:
path: /auth/**
serviceId: auth-service
book-service:
path: /book-service/**
serviceId: book-service
book-service-genres:
path: /api/genres/**
serviceId: book-service
host:
socket-timeout-millis: 10000
connect-timeout-millis: 10000
eureka:
client:
serviceUrl:
defaultZone: http://localhost:2580/eureka/
我遇到的问题是,当我发送请求时:
<zuul_gateway>/api/genres/listAll
该请求被转发到
<book-service>/listall
我希望它是 <book-service>/api/genres/listAll
所以所有 "matched" 路径都被删除了。我怎样才能禁用它 "feature" .
将 stripPrefix: false 设置为 book-service-genres。默认情况下,匹配的前缀被删除。