higress icon indicating copy to clipboard operation
higress copied to clipboard

Implement a plugin that can replace the response body according to the configuration

Open johnlanni opened this issue 3 years ago • 1 comments

Why do you need it?

实现一个插件,可以匹配应答和状态码返回自定义应答

Implement a plugin that can replace the response body according to the configuration

How could it be?

config example:

rules:
- match:
     status: 403
     body: "RBAC: access denied"
  replace:
     status: 200
     body: "{\"code\":403,\"message\":\"User is not authenticated\"}"
     content-type:  "application/json;utf-8"
- match:
     status: 503
     body: "no healthy upstream"
  replace:
     status: 200
     body: "{\"code\":503,\"message\":\"No Healthy Upstream\"}"
     content-type:  "application/json;utf-8"

Other related information

Add any other context or screenshots about the feature request here.

johnlanni avatar Nov 23 '22 08:11 johnlanni

Hi

zhangjiahaol avatar Nov 23 '22 08:11 zhangjiahaol