问题描述
我正在转发到一项服务,但它似乎添加了尾部斜杠。如果我点击 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 (将#修改为@)