首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >快速网关获取“无法获取”

快速网关获取“无法获取”
EN

Stack Overflow用户
提问于 2020-01-09 22:50:59
回答 1查看 371关注 0票数 0

我遵循快速网关入门指南。

这是示例配置

代码语言:javascript
运行
复制
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

如果我运行npm,启动并导航localhost:8080/ip,我会看到响应。

但是,如果我将httpbin url更改为"localhost:3001“,如果我导航localhost:8080/ip,响应是”无法获得ip/“。为什么?

在3001端口上,我有一个产生响应的工作服务。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-06 16:26:07

最后我找到了解决办法。

将路径选项添加到

- action: serviceEndpoint: {apiName} ignorePath: false prependPath: true stripPath: true

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59673254

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档