我想向我的快速網關添加引數,
我遵循了官方檔案。所以我的管道是這樣的:
- name: shop
apiEndpoints:
- shop
policies:
- proxy:
- action:
serviceEndpoint: shopsrv
changeOrigin: true
- request-transformer:
- action:
body:
add:
hello: "'world'"
headers:
add:
r-test: "'header value'"
當我向 express-gateway/shop 服務發送請求時,網關正常作業。
但是當我從商店服務記錄請求標頭和請求正文時
req.body :
{}
-----------------
req.headers :
{
connection: 'upgrade',
host: 'ec2-54-245-43-241.us-west-2.compute.amazonaws.com',
'accept-encoding': 'gzip, deflate, br',
'postman-token': '031920ee-c3e9-4b2f-9464-2e2c1edb3c41',
accept: '*/*',
'user-agent': 'PostmanRuntime/7.28.4',
'eg-request-id': '0hPlQg2jp7ar700zvniG2P'
}
為什么我不能在請求中添加任何引數?哪里有問題?請幫忙!
uj5u.com熱心網友回復:
代理策略的檔案說明代理策略必須排在最后;您需要重新排序管道以符合以下要求:
- name: shop
apiEndpoints:
- shop
policies:
- request-transformer:
- action:
body:
add:
hello: "'world'"
headers:
add:
r-test: "'header value'"
- proxy:
- action:
serviceEndpoint: shopsrv
changeOrigin: true
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/411370.html
標籤:
上一篇:Express.jsER_TRUNCATED_WRONG_VALUE_FOR_FIELD:不正確的整數值:第1行的列'id'的''
