【发布时间】:2021-01-31 04:21:32
【问题描述】:
我正在试图弄清楚如何让 Express Gateway 在请求中使用 Auth Bearer 令牌,上游到 api 服务。
以下是我目前的配置。
http:
port: 8080
admin:
port: 9876
host: localhost
apiEndpoints:
api:
host: localhost
paths:
- '/truck-api/*'
- '/car-api/*'
serviceEndpoints:
truck-service:
url: 'http://10.0.0.2:5010/api'
car-service:
url: 'http://10.0.0.2:5011/api'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
- rewrite
- request-transformer
pipelines:
default:
apiEndpoints:
- api
policies:
- proxy:
-
condition:
name: pathMatch
pattern: "^/truck-api/(.*)"
action:
serviceEndpoint: truck-service
prependPath: true
ignorePath: false
stripPath: true
changeOrigin: true
-
condition:
name: pathMatch
pattern: "^/car-api/(.*)"
action:
serviceEndpoint: car-service
prependPath: true
ignorePath: false
stripPath: true
changeOrigin: true
前端使用正确的身份验证承载令牌调用 Express 网关,但是 Express 网关不会将该身份验证承载令牌转发到上游服务。
建议?
【问题讨论】:
标签: express-gateway