[英]Express Gateway get "Cannot get"
i follow the getting started guide for Express Gateway.我遵循 Express Gateway 的入门指南。
This is the example configuration这是示例配置
http:
port: 8080
admin:
port: 9876
host: localhost
apiEndpoints:
api:
host: localhost
paths: '/ip'
serviceEndpoints:
httpbin:
url: 'https://httpbin.org'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
default:
apiEndpoints:
- api
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- proxy:
- action:
serviceEndpoint: httpbin
changeOrigin: true
and if I run npm start and navigate localhost:8080/ip I see the response.如果我运行 npm start 并导航 localhost:8080/ip 我会看到响应。
But if i change httpbin url to "localhost:3001" if I navigate localhost:8080/ip the response is "Cannot GET ip/".但是,如果我将 httpbin url 更改为“localhost:3001”,如果我导航 localhost:8080/ip,则响应为“无法获取 ip/”。 Why???
为什么???
On port 3001 i have a working service that produce response在端口 3001 上,我有一个产生响应的工作服务
Finally I found the solution.最后我找到了解决方案。
Add path options under在下面添加路径选项
- action: serviceEndpoint: {apiName} ignorePath: false prependPath: true stripPath: true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.