add plugin gw-error-format (#116)

Co-authored-by: 澄潭 <zty98751@alibaba-inc.com>
This commit is contained in:
jiahao zhang
2023-05-04 09:42:41 +08:00
committed by GitHub
parent 48978e5135
commit daffd18674
6 changed files with 223 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
apiVersion: extensions.istio.io/v1alpha1
kind: WasmPlugin
metadata:
name: gw-error-format
namespace: higress-system
spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
rules:
- match:
statuscode: "200"
responsebody: "bar"
replace:
statuscode: "401"
responsebody: "{\"code\":401,\"message\":\"User is not authenticated\"}"
- match:
statuscode: "503"
responsebody: "no healthy upstream"
replace:
statuscode: "200"
responsebody: "{\"code\":404,\"message\":\"No Healthy Service\"}"
set_header:
- access-control-allow-credentials: "true"
- access-control-allow-origin: "*"
- access-control-expose-headers: "*"
- content-type: "application/json;charset=UTF-8"
- custom-header: "HelloWorld"
url: oci://docker.io/zhangjiahaol/envoy-plugin:gw-error-format-2.0.0