如何解决在 Express Gateway 中,如何停止添加尾部斜杠的代理端点
我正在转发到一项服务,但它似乎添加了尾部斜杠。如果我点击 localhost:9999/api/v1/apiary
,它会转发到 apiary:3000/crud/
(带有尾部斜杠),即使我没有配置尾部斜杠。
如果我从 /crud
中删除 urls
,它不会添加尾部斜杠。
我如何获得 localhost:9999/api/v1/apiary
代理到 apiary:3000/crud
?
http:
port: 9999
admin:
port: 9876
host: 0.0.0.0
apiEndpoints:
# see: http://www.express-gateway.io/docs/configuration/gateway.config.yml/apiEndpoints
api:
paths:
- /api/v1/apiary
serviceEndpoints:
# see: http://www.express-gateway.io/docs/configuration/gateway.config.yml/serviceEndpoints
apiary:
urls:
- http://apiary:3000/crud
policies:
- proxy
pipelines:
# see: https://www.express-gateway.io/docs/configuration/gateway.config.yml/pipelines
api:
apiEndpoints:
- api
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- proxy:
- action:
serviceEndpoint: apiary
prependpath: true
ignorePath: false
stripPath: true
我发现如果我将 ignorePath
更改为 true
,它对根有效。但这意味着我必须为 /api/v1/apiary/*
中的任何内容设置一个不同的管道,这将形成一个非常湿的配置文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。